Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rookie_sql
Constraint Violating Yak Guru
443 Posts |
Posted - 2008-05-29 : 07:27:27
|
| Hey i have a query i need help with.I have a table where i have 4 columns in it which i need to group together and then sum up a cost column also. I want to sum up the columns where i have a parent and and child and then i want to sum up the other column where i have only a child.Example of the data is below. I think i need to do this in a sub query ID Ind Parent Child Cost P 1 100410 127059 21.8000W 1 100410 127059 5.4500A 1 100410 127059 21.8000B 1 100410 127059 16.3500R 1 100410 127059 16.3500B 0 100420 0 43.3000P 0 100420 0 43.3000W 0 100420 0 21.6500 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-05-29 : 07:32:41
|
So what is the expected output for this? quote: then i want to sum up the other column where i have only a child.
I don't see any such record in sample data you posted.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|
|