Guest User

Untitled

a guest
Jan 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. select distinct company.name, goods.name, shipmentCount.goodsSum from company
  2. left join shipment on company.compid=shipment.compid
  3. left join goods on goods.goodid=shipment.goodid
  4. left join
  5. (select sum(shipment.quantity) as goodsSum, goodid from shipment group by compid, goodid) as shipmentCount
  6. on shipmentCount.goodid=goods.goodid
Add Comment
Please, Sign In to add comment