简体   繁体   中英

SQL query that merges two tables together with a where clause

Hi I want to search through table 2 with a value (names CustID) from table 1, and if all the values are found in table 2 (CustID) that matches table 1 (CustID) the values must be shown together with all the values from table 1 that does not match table 2's values.

Is it possible to do it this way and if it is can you please show me how, I need this for a project.

Thanks in advance

It sounds like you want a "LEFT" JOIN, which will pull up all records in table1 plus the matching ones in table2.

SELECT A. ,B. FROM table1 A LEFT JOIN table2 B ON A.CustID = B.CustID

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