I'm attempting to get only those records from the left table that are not in the right. In the left table, I have about 5000 records. Similarly, the same process must be done on more than three or four tables. I need to find records from the first table that aren't in the other 3-4 tables. They are using the same main or foreign key idea.
My first effort, using two tables, yielded 5,70,000 records from the initial 5k data. I've read other articles like this on scaler topics but couldn't quite get it.
SELECT m.* FROM members m, pinnumber p where p.pinmemberid != m.memberid
My second try caused my-sql browser to hang as well.
SELECT m.* FROM members m LEFT JOIN pinnumber p ON p.pinmemberid != m.memberid LEFT JOIN customer c ON m.memberid != c.memberid
My third try is likewise making a lot of time
SELECT * FROM members m WHERE 1=1 AND AND not exists ( select 1 from pinnumber p where 1=1 And p.pinmemberid = m.memberid AND p.pinproductid LIKE '%Remit%') AND not exists ( select 1 from customer c where 1=1 and c.card_name is not null AND m.memberid = c.memberid )
Please advise me on what to do with this. If I need to put non-equi join on this.