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 ') ORDER BY datum asc' at line 4SELECT h.*, m.azon FROM hirek h LEFT JOIN meta m ON(m.id=h.hir_id AND tabla = 'hirek') WHERE h.hir_id IN () ORDER BY datum asc