Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Developer Toolkits / October 2005

Tip: Looking for answers? Try searching our database.

Need a query to split one column into three

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike H - 18 Oct 2005 03:27 GMT
I need a query that will split one column in a table into three new columns,
so that each of the three columns is the count of values in the original
column.

For example, my original table looks like this:
  Product, Date, PF  
where PF will be "P", "F" or "R"

And I want the query results to look like this:
  Product, Date, CountP, CountF, CountR
where CountP = number of "P" in PF ...
using Group By Product, Date

The query would look something like this:
SELECT Product, Date, Count(Pass in ("P")),
Count(Pass in ("F")), Count(Pass in ("R"))
FROM InspectLog
GROUP BY Product, Date, InspectLog.Pass;

Except, Count(InspectLog.Pass in ("P")) won't work.

Is there any way I can split one column into three columns like this?
Alex Dybenko - 18 Oct 2005 08:55 GMT
Hi,
i think a crosstab query with fixed comn headings is what you need, try to
look as it

Signature

Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

>I need a query that will split one column in a table into three new
>columns,
[quoted text clipped - 19 lines]
>
> Is there any way I can split one column into three columns like this?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.