我有一个查询,它返回来自客户的发货的 SUM 值及其分组shipment_id
。值是正确的。
SELECT SUM(DISTINCT((article.unit_price * article.tax)*shipment.amount)) as subtotal
FROM shipment
INNER JOIN customer ON customer.customer_id = shipment.customer_id
INNER JOIN article ON shipment.article_id = article.article_id
WHERE shipment.type_id = 2
AND shipment.customer_id = 947
GROUP BY shipment.shipment_id
当我删除 GROUP BY 以从客户那里获取总值时,返回的值不正确。
有人可以帮我解决这个问题吗?