Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare combination of two column with combination of other two in SQL

I have 2 tables, tbl_NameCode and tbl_Bkp both having columns ID and Name.

I have to select records from tbl_NameCode which are not in tbl_bkp.

SELECT * FROM tbl_Bkp 
WHERE ? */COMBINATION OF ID,Name NOT IN (SELECT COMBINATION OF ID,NAME FROM tbl_NameCode )*/

How to compare the combination of two columns with combination of other two?

like image 472
Sharon Avatar asked Dec 19 '22 08:12

Sharon


1 Answers

If am not wrong Except operator should work.

SELECT Id1,Id2,Id3,..Name FROM tbl_Bkp
Except
select Id1,Id2,Id3,..Name from tbl_NameCode 
like image 83
Pரதீப் Avatar answered Mar 30 '23 00:03

Pரதீப்