Nilesh Nilesh - 1 year ago 80
SQL Question

SQL join ON not equal in Mysql

I have two tables. Both contains question id field. I want to get all records from first table that are not present in second one. I don't want to use "NOT IN" constrain as second table having more than 400000 records.

Answer Source

Try something like

SELECt  t1.*
FROM    Table1 t1 LEFT JOIN
        Table2 t2   ON  t1.questionID = t2.questionID
WHERE   t2.questionID IS NULL
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download