Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 PIVOT Query

Author  Topic 

imrul
Starting Member

36 Posts

Posted - 2008-07-29 : 07:12:15
Hi,
I have run the following query against Nortwind database to test the PIVOT query , but having problem with it. Can anyone help?


Use Northwind
Select Customerid,employeeid
From (Select Customerid,employeeid from orders)O
PIVOT
(COUNT (employeeid) FOR Customerid IN ([4],[5])) AS pvt

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-29 : 07:17:13
What problem do you have?
Also see http://weblogs.sqlteam.com/peterl/archive/2008/07/15/PIVOT-conundrum.aspx




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-29 : 08:38:43
Nortwind database ? Are you using SQL Server 2000 or 2005 ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-29 : 11:21:39
Please note that PIVOT is only available on SQL 2005 onwards with compatibility level 90 and higher
Go to Top of Page
   

- Advertisement -