You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION ALL SELECT * FROM billede_tekster where E_ID = '0' ) t1 GROUP BY Nr' at line 1