22,209
社区成员
发帖
与我相关
我的任务
分享
select a.id,a.storename,a.commentcount,b.bannercount from
(select store.id,storename,count(comments.storeid)as commentcount from store
left join comments on comments.storeid=store.id
group by store.id)a,
(select store.id, count(banner.storeid)as bannercount from store
left join banner on banner.storeid=store.id
group by store.id)b
where a.id=b.id
select
count(comments.storeid),count(banner.storeid),store.id,store.storename
from store left join comments on
comments.storeid=store.id
left join banner on
banner.storeid=store.id
group by store.id
order by rate,id