I need to get one set of rows (it will be more than 70k records) from one table which are not in another table.
Table1 : Number of records will be more than 14000k
Table2 : Number of records will be more than 110k
So my SQL query is
SELECT pre.`id` , pre.`deal_id` , pre.`coupon_code` , pre.`csv`
FROM `customerorders` AS oc, `precoupon` AS pre
WHERE oc.`uniqueid` != pre.`coupon_code`
The problem is it never able to completes.
It kept loading and at the end a white page on phpmyadmin I get this message.
memory exhausted – fatal error on PHP whatever size i have in ini_set
No results in SSH for long long time.
Is there any problem with the query or is there any optimized query for this?
I need to export these second table records if the particular column not available in table1.
Please help me someone. Thanks in advance
try it with left joins like this: