2014-10-21 09:22:13 SELECT t.*, d.production_time, d.production_time_from, d.production_time_to, CONCAT(d.pimage_alt,t.item_name) AS alt_tag, d.pimage_src, d.pimage_list_src, d.pimage_list_width, d.pimage_list_height, d.smalldescr , d.onsale, IF(d.onsale=1,MIN(pg.price_sale),MIN(pg.price)) AS price_ob, IF(d.onsale=1,MAX(pg.price_sale),MAX(pg.price)) AS price_max, MIN(pg.count_from) AS mincountfrom FROM treeman AS t INNER JOIN dt_product AS d ON (d.item_id=t.item_id) INNER JOIN price_grid AS pg ON (pg.item_id=t.item_id AND pg.vendor_id IS NULL INNER JOIN pcolors AS pc ON(pc.item_id=t.item_id) INNER JOIN pcolors_colors AS pcc ON(pcc.pcolor_id=pc.pcolor_id) INNER JOIN colors ON(colors.color_id=pcc.color_id) ) WHERE t.item_id IN(6863, 47610, 47609, 47614, 47617, 47611, 47613, 47615, 47608, 47612, 47616) AND t.active=1 AND ((colors.color_id='1')) GROUP BY t.item_id ORDER BY price_ob mysql-error - 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 'INNER JOIN pcolors AS pc ON(pc.item_id=t.item_id) INNER JOIN pcolors_colors AS p' at line 6(1064)