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 |
|
jrich523
Starting Member
4 Posts |
Posted - 2006-03-09 : 12:21:16
|
| I have a table of product names (raw materials) and i have a history of when they come in. so i want to do something like... for each product get the total number in inventory.table: productsname (pk)table: invname, grossfor each products.name get the sum(inv.gross)there is obviously more in each table but this is the only data i need to work with for this query..my sql is pretty weak as it is so this is over my head a bit.. but im pretty sure this can be done.ThanksJustin |
|
|
JoeNak
Constraint Violating Yak Guru
292 Posts |
Posted - 2006-03-09 : 12:58:46
|
| select p.[name], sum(isnull(i.gross, '0'))from products pleft outer join inv i on p.[name] = i.[name]group by p.[name] |
 |
|
|
jrich523
Starting Member
4 Posts |
Posted - 2006-03-09 : 13:15:01
|
| your my hero, thanks :)the best part is i barely understand whats its doing lol..thankfully at this point i dont have to. again, thank you. |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-03-09 : 14:09:00
|
quote: Originally posted by jrich523...the best part is i barely understand whats its doing lol..thankfully at this point i dont have to...
Yes, there's no chance that it's not doing exactly what you hope it's doing. CODO ERGO SUM |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|