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 (220,256,273,330,352,354,373,382,453,486,511,542,58' at line 1SELECT DISTINCT(FldAtPrimkey) FROM TblShopBestellPos JOIN TblShopArtikel ON (FldBpArtikelId = FldAtArtikelId) JOIN TblShopArtikelKat ON (FldAkPrimArtikel = FldAtPrimkey WHERE FldBpPrimBestellung IN (220,256,273,330,352,354,373,382,453,486,511,542,587,628,632,641,729,784,789,892,925,926,958,965,975,992,1189,1248,1265,1329,1391,1435,1470,1525,1550,1864,1889,1904,1911,1949,1993,2054,2076,2079,2090,2119,2273,2281,2321,2372) AND FldAkSegmentNr IN(1,0) AND FldAtGeloescht = 0 AND UPPER(FldAtStatus) NOT IN ('GESPERRT','INAKTIV','SYSTEM') AND FldAtWebAnzeige = 1 AND FldAtArtikelId != '20255' ORDER BY RAND() LIMIT 6