Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
156 views
in Technique[技术] by (71.8m points)

一个MySQL查询问题

两个表,一个是t_table1t_table2

t_table1 字段 id:1,2,3,4,5,6

t_table2 字段 id:3,6

现在想查出 t_table1 表里面的 1,2,4,6

也就是想查t_table2表里面没有的


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

这不就计算差集

MySQL不支持EXCEPT

SELECT * FROM t1 WHERE id NOT IN (SELECT id FROM t2);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...