谁知道这个sql 怎么写?
a 是考勤表 b 是员工表 用一个sql怎么查询出 考勤表里面没有记录的员工
select b.username from b where not exists (select 0 from a where username=b.username)
应该是select * from b where not exists (select 0 from a where a.xingming=b.xingming)
SELECT B.Name FROM B LEFT JOIN A ON B.UserID=A.UserID
WHERE A.UuserID IS NULL
SELECT B.Name FROM A RIGHT JOIN B ON B.UserID=A.UserID
WHERE A.UuserID IS NULL
select * from a where a.id not in (select id from b) and a.id not in (select id from c)