I am having below tables.
create table test(int id,int data1);
create table test1(int id,int data2);
insert into test values(1,1,);
insert into test1 values(2,2);
insert into test1 values(3,3);
insert into test1 values(1,1);
Now I want the rows of test, that don’t participate in join. i.e I want rows (2,2) and (3,3). I want to be able to do this in mysql.
I don’t want to use inner query because of performance.
Thank you
Using LEFT JOIN/IS NULL:
Assuming the columns being joined on, this is the fastest/most efficient method on MySQL. Otherwise, NOT IN/NOT EXISTS are better choices.
Using NOT EXISTS: