Its something like this SELECT col1, IFNULL((SELEC...
# exposed
s
Its something like this SELECT col1, IFNULL((SELECT avg(rating) FROM ratings WHERE id = items.id), 0) as rating FROM items ORDER BY rating