Link to home
Start Free TrialLog in
Avatar of cl5bc
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
ASKER CERTIFIED SOLUTION
Avatar of ee_rlee
ee_rlee
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks for correcting me.

it should be total instead of 1.
Avatar of cl5bc
cl5bc

ASKER

I used the pivot function under 2005 in the end

PIVOT (
SUM(TOTAL) FOR ONLINEORDER IN ([N],[Y])