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 'WHERE FldBpPrimBestellung IN (66053,66350,67724,68012,69104,70425,73984,75042,78' at line 1SELECT DISTINCT(FldAtPrimkey) FROM TblShopBestellPos JOIN TblShopArtikel ON (FldBpArtikelId = FldAtArtikelId) JOIN TblShopArtikelKat ON (FldAkPrimArtikel = FldAtPrimkey WHERE FldBpPrimBestellung IN (66053,66350,67724,68012,69104,70425,73984,75042,78006,82011,82410,85382,85453,87214,90000,92941,98152,98505,106875,107556,114035,114293,115984,117200,117282,122001,125028,137031,149114,149580,153580,154848,157304,157316) AND FldAkSegmentNr IN(1,0) AND FldAtGeloescht = 0 AND UPPER(FldAtStatus) NOT IN ('GESPERRT','INAKTIV','SYSTEM') AND FldAtWebAnzeige = 1 AND FldAtArtikelId != '95053' ORDER BY RAND() LIMIT 6