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 |
Shannon Sears
Starting Member
1 Post |
Posted - 2009-11-28 : 16:44:12
|
I need a query to generate a list with the following fields:Itemcode, Sum(Order.Rowtotal), Sum(Ship.Rowtotal) for the Period > '20091101' And < '20091130' And where Orderstatus = 'C'From Order Table:Order.id, Order.Itemcode, Order.Rowtotal, Order.Date, Order.Status From Ship Table:Ship.Id, Ship.Baseid (same as Order.id), Ship.Itemcode, Ship.Rowtotal, Ship.DateOrder table includes all orders.Ship Table only includes records for items that have shipped.Any help would be appreciated. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-11-29 : 12:48:26
|
just do a LEFT JOIN with ship table and group on Itemcode and apply sum over required fields. |
|
|
|
|
|