I've got a query that looks like this:
select a.title, is.filename
from articles a
join article_images ai on ai.article_id = a.article_id
join images i on i.image_id = ai.image_id
join image_sizes is on is.image_id = i.image_id
where is.size_name = '96x96';
So there is an N:N relationship between articles and images, and an N:1 relationship between images and image sizes. This selects the 96x96 image for each article.
Now I want to change this so it selects the 96x96 image, unless the article_id
is 42, in which case it selects a different size. Is there a way to do that in one query?