SELECT a.id (SELECT dateiname, id FROM photos WHERE user_id = a.id) AS (file_name, file_id)