Topic: Another mysql-question
Hi!
I have this query:
SELECT a.*, i.filename AS first_image FROM ads AS a INNER JOIN ads_images AS i ON i.adid = a.adid WHERE ... GROUP BY adid ORDER BY a.timestamp DESC, i.filename ASC LIMIT 10;
As you can se there are two tables. An ad could have one image (or more than one) or no image at all. The ads_images contains only images, and no null-value-rows for the ads who dont have images (rows with the adid and null for the rest of the columns that is).
The query above results only rows containing ads with images, the ones without are not selected since there is no adid in ads_images for that ad. Is there another solution to this than to insert "null-rows" to the ads_images but only containing the adid?