I have the following situation:
CREATE TABLE SalesLog (
vendorID int
, salesDate datetime
, salesTypeID int
, totalSales int )
INSERT INTO SalesLog VALUES ( 1, '1/1/2006', 1, 203 )
INSERT INTO SalesLog VALUES ( 1, '1/1/2006', 2, 77 )
INSERT INTO SalesLog VALUES ( 1, '1/1/2006', 3, 100 )
INSERT INTO SalesLog VALUES ( 2, '1/1/2006', 1, 9 )
INSERT INTO SalesLog VALUES ( 2, '1/1/2006', 2, 0 )
INSERT INTO SalesLog VALUES ( 2, '1/1/2006', 3, 23 )
I wish to present this information in summary format like this:
1, '1/1/2006', 203, 77, 100
2, '1/1/2006', 9, 0, 23
I believe the PIVOT function will help but I am having problems utilizing it.
Can someone please help?