Why can't i do a crosstab query in sqlserver (1 Viewer)

MsLady

Traumatized by Access
Local time
Today, 08:49
Joined
Jun 14, 2004
Messages
438
Okay! I've had it! Why is crosstab query a nightmare in sql server :mad:
This is absolutely ridiculous and i can't imagine why they left the feature out :rolleyes:

Seeing as this is just a piece of cake in Access and it will run smoothly without pulling teeth but i am made to understand (by the powers that be) that i have to do some karate with sqlserver to get the same results. imagine that. If any sweet somebody can figure it out, please show me how!
Code:
TRANSFORM Count(Employees.MaritalStatus) AS MaritalStatusCount
SELECT Employees.MaritalStatus
FROM Employees INNER JOIN Offices ON Employees.OfficeId = Offices.officeId
WHERE ((Not (Employees.MaritalStatus) Is Null))
GROUP BY Employees.MaritalStatus
PIVOT Offices.officeLocation;
Thank you.
 

Banana

split with a cherry atop.
Local time
Today, 08:49
Joined
Sep 1, 2005
Messages
6,318
Would it be easier to use a sub-query to pull the dataset from SQL server then use that set to create a crosstab query locally?
 

Banana

split with a cherry atop.
Local time
Today, 08:49
Joined
Sep 1, 2005
Messages
6,318
First, make a ODBC query that will gather all data you need for a crosstab query. Depending on how your data are stored, you may need just one or maybe more. Be sure to use a WHERE clause to filter the data as you need to.

Then make another query, and base it on the first query and make it a crosstab query.

I hope that makes sense...
 

Users who are viewing this thread

Top Bottom