SELECT DISTINCT p.id_marki, p.nr_id, p_t.nazwa, p_t.opislista, p.img_lista, p.img_opis, p.cena, p.cena_netto, p.cena_promocja_rabat, p.id_vat, p.typ_prod, p.typ_karnisza, p.flag_nowosc, p.flag_promocja, (SELECT CONCAT(sw.nr_id, '[|]', sw.cena, '[|]', sw.id_szer, '[|]', sw.id_wys, '[|]', sw.cena_sznur, '[|]', sw.cena_koral) FROM karnixsklep_rol_szerwys sw INNER JOIN karnixsklep_rol_szer r_s ON r_s.nr_id=sw.id_szer INNER JOIN karnixsklep_rol_wys r_w ON r_w.nr_id=sw.id_wys WHERE sw.id_produktu=p.nr_id AND sw.is_active=1 AND r_s.is_active=1 AND r_w.is_active=1 ORDER BY sw.cena LIMIT 1) AS dane_szerwys, (SELECT nk.nazwa FROM karnixsklep_sklep_kategorie_translate nk WHERE nk.tnr_id=k.id_kategorii AND nk.lang_id=1 LIMIT 1) AS kat_nazwa, rmk.id_koloru AS rol_kol_id, rkt.kolor AS rol_kol_nazwa, rmk.id_mech AS rol_mech_id, rm_t.nazwa AS rol_mech_nazwa, rm.mod_ceny AS rol_mech_mod_ceny, rmk.img AS rol_img FROM karnixsklep_sklep_produkty p LEFT JOIN karnixsklep_sklep_produkty_translate p_t ON p_t.tnr_id = p.nr_id AND p_t.lang_id=1 INNER JOIN karnixsklep_sklep_produkty_powkat k ON k.id_produktu=p.nr_id INNER JOIN karnixsklep_sklep_kategorie skmark ON skmark.nr_id=k.id_kategorii LEFT JOIN karnixsklep_rol_kolory rk ON rk.id_produktu=p.nr_id AND p.typ_prod=1 LEFT JOIN karnixsklep_rol_kolory_translate rkt ON rkt.tnr_id = rk.nr_id AND rkt.lang_id = 1 LEFT JOIN karnixsklep_rol_mechanizm rm ON rm.id_produktu=p.nr_id AND p.typ_prod=1 LEFT JOIN karnixsklep_rol_mechanizm_translate rm_t ON rm_t.tnr_id=rm.nr_id AND rm_t.lang_id=1 LEFT JOIN karnixsklep_rol_mechanizm_kolor rmk ON rmk.id_produktu=p.nr_id AND rmk.id_koloru=rk.nr_id AND rmk.id_mech=rm.nr_id AND p.typ_prod=1 LEFT JOIN karnixsklep_rol_odcien_pow kolzp ON kolzp.kol_id=rk.nr_id LEFT JOIN karnixsklep_rol_odcien kolz ON kolz.nr_id=kolzp.odcien_id WHERE p.nr_id <> 5742 AND p.typ_prod = 1 AND kolzp.odcien_id IN () AND IF (p.id_marki=38, rm.mechanizm_global_id=10, rm.mechanizm_global_id=1) AND p.flag_usun = 0 AND IF (p.typ_prod=1, rk.is_active, 1) = 1 AND IF (p.typ_prod=1, rm.is_active, 1) = 1 GROUP BY p.nr_id ORDER BY RAND() LIMIT 24;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 ') AND IF (p.id_marki=38, rm.mechanizm_global_id=10, rm.mechanizm_global_id=1) AN' at line 54