题解 | 下单最多的商品
下单最多的商品
https://www.nowcoder.com/practice/d7c93e3a3d5b4087896539121d32d367
SELECT product_id, sum(if(step='order',1,0)) AS cnt FROM user_client_log GROUP BY product_id ORDER BY sum(if(step='order',1,0)) DESC LIMIT 1;
下单最多的商品
https://www.nowcoder.com/practice/d7c93e3a3d5b4087896539121d32d367
SELECT product_id, sum(if(step='order',1,0)) AS cnt FROM user_client_log GROUP BY product_id ORDER BY sum(if(step='order',1,0)) DESC LIMIT 1;
相关推荐