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 (13479,13575,13702,13914,14615,14777,18150,18451,18' at line 1SELECT DISTINCT(FldAtPrimkey) FROM TblShopBestellPos JOIN TblShopArtikel ON (FldBpArtikelId = FldAtArtikelId) JOIN TblShopArtikelKat ON (FldAkPrimArtikel = FldAtPrimkey WHERE FldBpPrimBestellung IN (13479,13575,13702,13914,14615,14777,18150,18451,18529,19742,21312,26037) AND FldAkSegmentNr IN(1,0) AND FldAtGeloescht = 0 AND UPPER(FldAtStatus) NOT IN ('GESPERRT','INAKTIV','SYSTEM') AND FldAtWebAnzeige = 1 AND FldAtArtikelId != '902007' ORDER BY RAND() LIMIT 4