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 (27033,62195,62411,62480,62521,63954,65378,67159,67' at line 1SELECT DISTINCT(FldAtPrimkey) FROM TblShopBestellPos JOIN TblShopArtikel ON (FldBpArtikelId = FldAtArtikelId) JOIN TblShopArtikelKat ON (FldAkPrimArtikel = FldAtPrimkey WHERE FldBpPrimBestellung IN (27033,62195,62411,62480,62521,63954,65378,67159,67427,72856,77276,82593,82805,86908,89118,89499,90083,90100,90318,90421,91074,91493,91661,91884,92032,92165,92226,92320,92641,92696,93576,93752,93825,94636,94897,94967,95155,95512,95923,98000,98003,106484,106821,113312,113996,118711,118883,119251,121053,121079) AND FldAkSegmentNr IN(1,0) AND FldAtGeloescht = 0 AND UPPER(FldAtStatus) NOT IN ('GESPERRT','INAKTIV','SYSTEM') AND FldAtWebAnzeige = 1 AND FldAtArtikelId != '30183' ORDER BY RAND() LIMIT 6