[Quote=引用 3 楼 baby97 的回复:]
select 表1.username,表2.servicingid,count(*) from 表1 left join 表2 on 表1.userid=表2.servicingid
group by 表1.username,表2.servicingid having count(*) <2
[/Quote]
[Quote=引用 1 楼 ice_frank 的回复:]
select a.UserName,count(1) num from 表2 a
inner join 表1 b on a.ServicingID=b.UserID
group by a.UserName,b.ServicingID
where num <2
[/Quote]
[Quote=引用 1 楼 ice_frank 的回复:]
select a.UserName,count(1) num from 表2 a
inner join 表1 b on a.ServicingID=b.UserID
group by a.UserName,b.ServicingID
where num <2
[/Quote]