我有两张桌子,sfuser和会员
sfuser得到139,membership table得到50
我需要查询选择谁不是任何项目的成员,这意味着89个成员
这是我的问题

select sfuser.id,sfuser.username,sfuser.email from sfuser INNER JOIN projectmembership ON sfuser.id = projectmembership.member_id ;

但是我想把50个会员换成另一个
请给我点光
致意
萨提什

最佳答案

select
sfuser.id,
sfuser.username,
sfuser.email
from sfuser
LEFT JOIN projectmembership ON sfuser.id = projectmembership.member_id
WHERE
projectmembership.member_id is NULL

它应该返回所有不在projectmembership表中的用户。

08-28 04:21