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 'AS vozi, MAX(pr.castka) AS max, COUNT(pr.id) as prihozu, pd.video_id FROM predm' at line 2