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?