SELECT COUNT(*) AS `no` FROM produse,subdomeniu,domeniu_tip as p1 INNER JOIN (SELECT * FROM domeniu_tip GROUP BY id_produs HAVING MAX(id_domeniu_tip)) p2 ON p1.id_domeniu_tip = p2.id_domeniu_tip WHERE produse.id_produs=p1.id_produs AND subdomeniu.id_subcateg=p1.id_subcategorie AND p1.id_categorie="5" AND produse.rs_ro="Da" AND produse.promotie_fara_tva>"0" AND produse.promotie_fara_tva IS NOT NULL AND produse.promotie_fara_tva=NOW()) AND subdomeniu.id_subcateg IN () GROUP BY produse.id_produs
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 ') GROUP BY produse.id_produs' at line 10