具体什么原因,其实也不知道,网上说的是因为有一些表有多条数据导致的,但是以下代码在每个表都是只有一条数据。经过测试,加上 group by
即可解决问题,以下为示例:
select log.*,m.nickname,m.id as mid,m.avatar,o.ordersn,msaler.storeid,msaler.salername from `ims_w_store_goods_proxy_log` log left join `ims_w_store_member` m on m.openid = log.saleropenid left join `ims_w_store_order` o on o.id = log.orderid left join `ims_w_store_merch_saler` msaler on log.saleropenid=msaler.openid where 1 and log.uniacid=3 and log.status = 1 and o.merchid in(538,939,1191,161,6560,6674,6671,6707,6615) GROUP BY log.guid ORDER BY log.usetime DESC LIMIT 0,10