Anthony Matovu
asked on
data transformation from long to wide using a query
I am wondering if i can have a single query that can achieve the following results
Table (OrderDetails)
CustomerId DateofOrder AmountOrdered
C0001 12/06/2011 200,000
C0002 12/06/2011 200,000
C0003 12/06/2011 200,000
C0004 12/06/2011 200,000
C0005 12/06/2011 200,000
C0006 12/06/2011 200,000
C0001 05/07/2011 100,000
C0002 05/07/2011 100,000
C0003 05/07/2011 100,000
C0004 05/07/2011 100,000
C0005 05/07/2011 100,000
C0006 05/07/2011 100,000
Results of the query
CustomerId DateofOrder1 DateofOrder1 TotalAmountOrdered
(12/06/2011) (05/07/2011)
C0001 200,000 100,000 300,000
C0002 200,000 100,000 300,000
C0003 200,000 100,000 300,000
C0004 200,000 100,000 300,000
C0005 200,000 100,000 300,000
C0006 200,000 100,000 300,000
Table (OrderDetails)
CustomerId DateofOrder AmountOrdered
C0001 12/06/2011 200,000
C0002 12/06/2011 200,000
C0003 12/06/2011 200,000
C0004 12/06/2011 200,000
C0005 12/06/2011 200,000
C0006 12/06/2011 200,000
C0001 05/07/2011 100,000
C0002 05/07/2011 100,000
C0003 05/07/2011 100,000
C0004 05/07/2011 100,000
C0005 05/07/2011 100,000
C0006 05/07/2011 100,000
Results of the query
CustomerId DateofOrder1 DateofOrder1 TotalAmountOrdered
(12/06/2011) (05/07/2011)
C0001 200,000 100,000 300,000
C0002 200,000 100,000 300,000
C0003 200,000 100,000 300,000
C0004 200,000 100,000 300,000
C0005 200,000 100,000 300,000
C0006 200,000 100,000 300,000
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.