Click here to Skip to main content
15,919,341 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI all i had a requirement where i need to get a values from single table , the table has 3 colms id,name,value for id=1 i have 4 names (a,b,c,d) and has values for it like for a there are 10 values for b 10 values same for c and d, and for id=2 i have only 3 names (a,b,c) with 10 values for each , now my requirement here is to get the result in this way

name  id       values(sum(values))        id          values<br />
<br />
a       1             15                   2            187<br />
b       1              20                  2            168<br />
c       1             18                   2            132<br />
d       1             31                   Null         Null


i tried left outer join and inline query but i failed ,are they failing beacuse of same table values and group by i am not sure about it is there any way i can achieve it please guide me thanks
Posted

1 solution

Try showing us some of the actual query you have tried and we can possibly help. We are not here to simple do your homework for you. We're here to help you with problems that you have getting it done.
 
Share this answer
 
Comments
makwith9789 21-Jun-11 10:59am    
hi sorry Mr. Marcus just found my answer using CTE and Left outer Join

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900