我有两个表usr和mat,这里我正在尝试编写一个查询,其中mat假设给我结果(UID!= DID)只有来自mat表的不等值 即,(6,'q','r'),(7,'s','t')仅使用不存在,不存在或IN的连接
create table usr ( uid int, uco varchar, umo varchar);
insert into usr (uid,uco,umo) values (1,'k','l'), (2,'m','n'), (3,'o','p'), (6,'q','r'), (7,'s','t');
create table mat( did int, co varchar, mo varchar);
insert into mat (did,co,mo) values (1,'a','f'), (2,'b','g'), (3,'c','h'), (4,'d','i'), (5,'e','j');
答案 0 :(得分:5)
这可能是你正在看的 -
select * from usr left outer join mat on usr.uid = mat.did where did is null