开发者

how to do a SQL Join that returns the rows that are not present in my table 2

I want to run a query between my two tables and returns the results to me the lines that are not present in my table 开发者_如何学编程2


select * from table1 
         left join table2 
         on table1.id=table2.id 
         where table2.id is null


Look at this post.
I copied the code:

select * from A left join B on A.x=B.y where B.y is null;


Should be something like this:

SELECT * FROM table2 WHERE table1_id NOT IN (SELECT id FROM table1) 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜