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

来源:互联网 时间:1970-01-01


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




相关阅读:
Top