标签:
SELECT beatid,COUNT(d.id) dongnicount FROM `bed_beat_dongni` d INNER JOIN bed_beat b on b.id = d.beatid GROUP by beatid
SELECT b.*,ccc.dongnicount from bed_beat b left join(SELECT beatid,COUNT(d.id) dongnicount FROM `bed_beat_dongni` d INNER JOIN bed_beat b on b.id = d.beatid GROUP by beatid) ccc on ccc.beatid = b.id
标签:
原文地址:http://www.cnblogs.com/passby/p/4580860.html