简体   繁体   中英

Select from TableA.Code if IN TableB.Code

I have two tables

Table1

ID, CODE


Table 2 

ID, CODE

I want to select ALL Records from Table 1 Where Table1.Code exists in Table2.

SELECT * 
FROM table1 
WHERE EXISTS (SELECT * 
              FROM table2 WHERE table2.CODE = table1.CODE)

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