简体   繁体   中英

sql: select not in

how can I rewrite the following query using JOIN

SELECT * 
FROM table1 
WHERE id NOT IN 
( 
    SELECT t1Id 
    FROM table2 
);
SELECT * 
FROM table1 t1
left outer join table2 t2 on t1.id=t2.id
where t2.id is null
       SELECT * FROM table1 t1
       WHERE NOT EXISTS( 
        SELECT *
        FROM table2 t2 
        Where t1.Id = t2.t1Id);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM