2016-05-03 21:41:18 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, CONCAT_WS('/', dp.item_id, dp.icon_pic_src) AS icon_src, dp.position AS icon_position 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) ) LEFT JOIN field_dynamic_multi AS fdm ON (fdm.item_id = t.item_id AND fdm.field_name = 'icons') LEFT JOIN dt_prodicon AS dp ON(dp.item_id = fdm.refer_item_id) WHERE t.item_id IN(1378, 1379, 2615, 2861, 2863, 2864, 2936, 3037, 3572, 4668, 39831, 39715, 35810, 34368, 34398, 52688, 52689, 52690, 52691, 52692, 52693, 52694, 52708) AND t.active=1 AND ((colors.color_id='18')) 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)