Wednesday, December 15, 2010

How Sum Groups and provide totals in separate columns?

Programmer Question

I have beek looking at this problem for a while and while i know i could do this programiticly in LINQ. I started thinking about solutions that would scale if this were a vary large data set. I'm building my experieance with SQL and believe there is a way to get the result with out performing an insert.



What I have is data that looks like this:



ids type    total
A01 x 1
A01 x 2
A01 x 3
A01 y 4
B01 y 2
B01 x 3
B01 y 1
C01 x 1
C01 y 2
C01 x 5
C01 y 6


What I want is data that looks like this:



id  x total y total
A01 6 4
B01 3 3
C01 6 8


I's my belief incorrect?



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails