怎么写sql语句
表1
Userid Name
1 ewe
2 sdff
3 fsf
....
表2
Id Userid Pro
1 2 ddd
2 2 dsfsfd
3 2 sdf
4 3 fdsf
5 4 sdff
按name所拥有的表2中的pro所统计的数量进行高低排列,怎么写sql语句
------解决方案--------------------try
select count(*) pro from 表1 join 表2 on userid=name order by name desc
------解决方案--------------------select 表1.name isnull(t.c,0) as result
from 表1
left join (select count(Pro),Userid from 表1 group by userid) as t
------解决方案--------------------try
select count(*) pro from 表1 join 表2 on userid=name order by name desc
UP
------解决方案--------------------小鸟你咋不结帖呢?