我有两个表USER和Relation_User如何列出我想跟踪他们的所有用户已经跟不上我
User Table
Usid|name
---------
1 | Jack
2 | Bla
3 | Havi
4 | Tri
Relation_User
Rid|usid|fusid
--------------
1 | 1 | 2
2 | 2 | 1
3 | 3 | 2
4 | 1 | 4
答案 0 :(得分:0)
select usid, name from user u
where u.usid <> @id and u.usid not in (
select distinct fusid from relation_user where usid = @id
)