troubleshooting Question

data transformation from long to wide using a query

Avatar of Anthony Matovu
Anthony MatovuFlag for Uganda asked on
Microsoft AccessVisual Basic.NETMicrosoft SQL Server 2008
1 Comment1 Solution347 ViewsLast Modified:
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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros