如何结合两个SQL查询?

如何结合两个SQL查询?,第1张

如何结合两个SQL查询
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


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5675685.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存