0

我有两张桌子

Member (member_id,...)
friend-requests(member_id, friend_id)

我需要从 member_id 为 19 且不在列friend_id 中的成员表中获取所有记录

4

2 回答 2

1
select * from member join friend-requests
on member.member_id=friend_requests.member_id
where
member.member_id=19
and
not exists (select f.member_id from friend-requests f where f.mmeber_id = member.member_id)
于 2013-01-08T08:11:30.000 回答
0
Select m.* from Member as m 
where member_id=19 and 
member_id not in (select friend_id from friend_requests where member_id=19)
于 2013-01-08T08:10:21.263 回答