SELECT f.*, f.naam AS alt_tekst FROM edn_foto f INNER JOIN edn_nieuws n ON n.id = f.subgroep_id AND n.status = 0 WHERE f.groep_id = '20' AND f.subgroep_id = '12' AND f.status = 0 GROUP BY f.subgroep_id ORDER BY f.volgnr