sql中多表查询 还有COUNT

日期:2017-06-20 23:34:01 人气:1

sql中多表查询 还有COUNT

select tat.id ,tat.name ,count(tbt.id) as numbersd from test_a_temp tat,test_b_temp tbt where tbt.no=tat.id group by tat.id,tat.name order by numbersd desc 其中 test_a_temp 就是你那个A表,test_b_temp 就是B表 A中有两列 ID,NAME B中有两列 ID,NO(这个no就是A的ID)
    A+
热门评论