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 (13388,13437,13550,14196,14351,14700,15183,15259,16' at line 1SELECT DISTINCT(FldAtPrimkey) FROM TblShopBestellPos JOIN TblShopArtikel ON (FldBpArtikelId = FldAtArtikelId) JOIN TblShopArtikelKat ON (FldAkPrimArtikel = FldAtPrimkey WHERE FldBpPrimBestellung IN (13388,13437,13550,14196,14351,14700,15183,15259,16108,16134,17852,20629,21516,22849) AND FldAkSegmentNr IN(1,0) AND FldAtGeloescht = 0 AND UPPER(FldAtStatus) NOT IN ('GESPERRT','INAKTIV','SYSTEM') AND FldAtWebAnzeige = 1 AND FldAtArtikelId != '903503' ORDER BY RAND() LIMIT 4