I have two tables for creatives and its thumbnails. I want to query in a fallback way like:
Initially, the thumbnail will be displayed for 300x250
IF not available then 336x280,
IF not available then 300x600,
IF not available then 728x90,
IF not available then 160x600,
IF not available then 320x50,
IF not available then 300x50,
IF not available then 468x60
The table structure is like
creatives:
id INT
name VARCHAR
desc TEXT
creative_thumbs:
id
creative_id INT
dimension VARCHAR
img_url VARCHAR
I have made it with multiple joins (one for each dimension but it is a bit slow)