Log in

View Full Version : Crosstab Query in MS Access


sukkarfarid
Sep 18, 2006, 01:22 AM
How can I change the my query to crosstab query..
please see the picture..

http://www.l22l.com/l22l-up-1/8a7081adec.jpg (http://www.l22l.com)

I write this code... how can I change to a crosstab query

SELECT SeaTable.location, Count(SeaTable.location) AS CountOflocation
FROM SSFMainTable INNER JOIN SeaTable ON SSFMainTable.ID = SeaTable.MainTLink
WHERE (((SSFMainTable.AD) Between [enter1] And [enter]))
GROUP BY SeaTable.location
HAVING (((SeaTable.location) Like "G/A*" Or (SeaTable.location) Like "Qiz*"));

Thanks and regards
Farid

ScottGem
Sep 18, 2006, 06:07 AM
A crosstab query requires THREE columns in the source. One column for the Rows, one for the columns and one for calculation. So you have to add a column to your query. I would add a column like so:

Counts: " "

Use the Crosstab Wizard and make that column your ROW, make the Location column your Columns and then count the primary key field for your counts.