select p.product_id,count(u.product_id) as cnt from product_info p join user_client_log u on p.product_id = u.product_id where u.step = "order" group by p.product_id order by cnt desc , p.product_id asc limit 1
反思下问题啊
第一个是筛选条件看错,要求下单的商品,我查的是完成够购买的商品,也就是order状态和end状态写错了
再有就是join之后忘记on了,基本功还是不扎实
最后就是limit 1也忘了



京公网安备 11010502036488号