Forum Moderators: open
SELECT * FROM `_ads` JOIN `_images` ON _ads.adId = _images.adId JOIN `_zipcodes` ON _ads.zipcodeId = _zipcodes.zipcodeId ORDER BY RAND() LIMIT 0,4
My problem is that I have thousands of records in the _ads table, and over 30,000 entries in the _zipcodes table. So, this query is joining every ad to zip codes, when I really only need it to join the 4 I'm limiting the query to.
How can I do this?
Thanks!