cl5bc
asked on
Pivot Sql statement
Hi,
I have a table with the folowing structure
OrderDate Total Online
2/10/2007 1 Y
2/10/2007 1 N
Is it posible to convert it into the following in a single statement?
OrderDate Online OffLine
2/10/2007 1 1
I have a table with the folowing structure
OrderDate Total Online
2/10/2007 1 Y
2/10/2007 1 N
Is it posible to convert it into the following in a single statement?
OrderDate Online OffLine
2/10/2007 1 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I used the pivot function under 2005 in the end
PIVOT (
SUM(TOTAL) FOR ONLINEORDER IN ([N],[Y])
PIVOT (
SUM(TOTAL) FOR ONLINEORDER IN ([N],[Y])
it should be total instead of 1.