首页 > 这个嵌套查询,还有其他什么方式吗

这个嵌套查询,还有其他什么方式吗

select t.name,(select count(id) from b as t1 where t1.aid=t.id) num from a as t;
这个sql还有其他什么写法吗,能做成关联查询吗?


select a.name, s.count
from a, (
    select aid, count(aid) as count
    from b
    group by aid
) as s
where a.id = s.aid
【热门文章】
【热门文章】