mysql 分组总和求最大值 的两种方式

来源:转载


SELECT max(pp.totalPrice)FROM ( SELECT sum(oi.product_price) totalPrice FROM `order.item` oi GROUP BY oi.id ) as pp

SELECT oi.id, oi. sum(oi.product_price) AS ppFROM `order.item` oiGROUP BY oi.idorder by pp desc limit 1




分享给朋友:
您可能感兴趣的文章:
随机阅读: