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 |
sturner333
Starting Member
22 Posts |
Posted - 2014-10-03 : 14:25:35
|
I have 2 tables.table1 is projects with unique idtable2 is a bill of material(BOM) for those projectseach line item in the BOM has a column that corresponds to the project it belongs to. It also has a column that tells which of 3 buildings it is stored.I would like to have know the select statement for a running total cost(another column) for each each project by which building they come from.BOMprojNumbr(T2) buildingNumber(T2) partCost(T2) ---------------- ----------------- -------------1 2 $51 2 $31 3 $91 1 $33 2 3 $222 1 $72 1 $62 2 $89so i would have a result that would tell me for project2 building 1 the total is $13.Thanks for the help |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-10-03 : 14:33:55
|
select sum(partCost)from table1group by BOMprojNumber, buildingNumber |
|
|
|
|
|