SELECt a.item_id, a.stock_balance, b.pcs_ordered, b.number_of_ordersFROM (SELECt stock.item_id, Sum(stock.pcs) AS stock_balance FROM stock GROUP BY stock.item_id) aLEFT OUTER JOIN (SELECt stock.item_id, Sum(stock.pcs) AS pcs_ordered, Count(stock.item_id) AS number_of_orders FROM stock WHERe stock.operation = "order" GROUP BY stock.item_id) bON a.item_id = b.item_id
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)