开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜