34,838
社区成员




select distinct username from t3 a,t1 b where a.userid = b.id and
exists(select 1 from t3 where userid = @id and groupid = a.groupid)
select
c.*--指定显示列
from
t1 a
join
t3 b on a.ID=[user_id]
join
t3 c on c.group_id=b.group_id
where
a.[user_name]='AA'
select
d.*,c.*--指定显示列
from
t1 a
join
t3 b on a.ID=[user_id]
join
t3 c on c.group_id=b.group_id
join
t1 d on d.ID=c.[user_id]
where
a.[user_name]='AA'