Forum Moderators: open
1) impressions (id,keyword,visits)
2) sales (id,keyword,product_id,.......)
I want to grab a list of keywords which are present in impressions but not in sales. we are talking above 50k rows here and i have not been able to do any "Optimized" query for that yet. tried using HAVING with subquery but that almost kills the mysql deamon. Any solution thats executes fast ?
Thanks
select impressions.keyword from impressions LEFT OUTER JOIN sales on impressions.keyword = sales.keyword where sales.keyword is null
This should return keywords present in impressions but not in sales.
If you want a count of the records it returns, just add the count() function to it:
select count(impressions.keyword) from impressions LEFT OUTER JOIN sales on impressions.keyword = sales.keyword where sales.keyword is null
[edited by: Skywarden at 10:12 pm (utc) on Jan. 9, 2009]