Hi all, I have doubt in Pivot operator,please share your knowledge.using AdventuresWork DB in (SQL Server 2003):Select *from (select subtotal,customeridfrom Sales.SalesOrderHeader)sOrderHeaderpivot(sum(subtotal) for customerid in ([1],[2],[3],[4],[5],[6],[7],[9],[10],[11] )) as pvt
If u observer this partpivot(sum(subtotal) for customerid in ([1],[2],[3],[4],[5],[6],[7],[9],[10],[11] ))
Iam getting data for specific customer, sound like static to me.Is there way to query for all the customer Id's.Expecting somthing like thisSelect *from (select subtotal,customeridfrom Sales.SalesOrderHeader)sOrderHeaderpivot(sum(subtotal) for customerid in (select distinct customerid from Sales.SalesOrderHeader )) as pvt
Thanks in Advance,Jack.