Help CONVERT Access PIVOT QUERY to SQL SERVER (1 Viewer)

MsLady

Traumatized by Access
Local time
Yesterday, 19:24
Joined
Jun 14, 2004
Messages
438
Can anyone help me convert this pivot query to work in sql server please?
I'll love you forever if you help me please :p
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;
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 19:24
Joined
Aug 30, 2003
Messages
36,138
I can't have you loving me forever, as it would probably put my wife into a very sour mood. :p

There is no direct way as the Transform/Pivot syntax isn't supported in T-SQL (2000 anyway). There's a method in the "MS Access Developer's Guide to SQL Server" by Chipman Baron (an excellent book). Their code is apparently available at the publisher's website: www.samspublishing.com. The code is in chapter 12, if that helps in the search.
 

MsLady

Traumatized by Access
Local time
Yesterday, 19:24
Joined
Jun 14, 2004
Messages
438
I can't have you loving me forever, as it would probably put my wife into a very sour mood. :p

There is no direct way as the Transform/Pivot syntax isn't supported in T-SQL (2000 anyway). There's a method in the "MS Access Developer's Guide to SQL Server" by Chipman Baron (an excellent book). Their code is apparently available at the publisher's website: www.samspublishing.com. The code is in chapter 12, if that helps in the search.

whoah! i've seen the code and i can't understand jack! about what it's doing.
i know there are different methods. but this is pretty new to me.
any help in getting my Access pivot query to work in sqlserver 2000 will be greatly appreciated please :(

pbaldy: thanks, i appreciate the leads. ok don't want her in sour mood, so i'd settle at "loving" her forever instead ;) Hopefully that won't put you in a sour mood :D
 

Users who are viewing this thread

Top Bottom