我有两张桌子 AORDER 用于购买和 BORDER 出售。我想获得待定数量。销售订单可以针对一份采购订单包含 1 条以上的记录。我不想显示那些挂起数量为 0 的订单。我试过这个:
SELECT ;
aorder.orderid,;
aorder.orderdate,;
aorder.itemname,;
aorder.partyname,;
aorder.qty as Purchase,;
SUM(border.qty) AS Sale,;
SUM(aorder.qty-border.qty) as Pending;
FROM ;
aorder;
LEFT JOIN border ;
ON aorder.orderid = border.porderid;
GROUP BY ;
aorder.orderid,;
aorder.orderdate,;
aorder.itemname,;
aorder.partyname,;
aorder.qty
但是我没有隐藏那些购买数量=销售数量的记录。
提前谢谢。