SQL how to compare two columns from two different tables

后端 未结 6 1641
无人共我
无人共我 2021-01-02 16:24

I have two tables, in which table 1 contains 4 columns while table 2 contains 8 columns. I have two columns in table1 that I want to compare them with two columns in table2.

6条回答
  •  轮回少年
    2021-01-02 16:50

        select * from table1 where column1 not in(select column 6 from table2) or column2 not in(select column7 from table2)
    

    This will give you rows from table1 where there are differences between col1 and col6 or col2 and col7

    Hope this helps

提交回复
热议问题