Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select distinct company.name, goods.name, shipmentCount.goodsSum from company
- left join shipment on company.compid=shipment.compid
- left join goods on goods.goodid=shipment.goodid
- left join
- (select sum(shipment.quantity) as goodsSum, goodid from shipment group by compid, goodid) as shipmentCount
- on shipmentCount.goodid=goods.goodid
Add Comment
Please, Sign In to add comment