2015-03-28 01:43:01 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(1356, 1460, 1463, 1465, 2755, 3318, 3323, 3519, 3523, 3526, 3527, 3529, 3530, 3532, 3538, 1464, 3539, 3543, 3545, 5144, 5212, 5213, 5216, 3517, 3518, 7250, 3521, 7253, 7260, 1497, 3452, 3528, 2841, 3531, 7401, 3319, 7410, 3520, 37972, 3522, 7255, 3524, 3533, 3541, 7256, 36725, 3534, 36735, 36741, 3884, 36757, 36759, 5215, 36751, 36775, 5901, 3535, 3540, 5217, 7988, 36713, 42251, 7252, 43905, 7257, 43906, 7941, 46841, 2839, 47903, 7258, 47909, 36727, 36737, 36749, 48256, 1594, 2749, 7745, 1291, 2838, 2833, 2847, 2837, 42981, 2840, 36787, 2928, 43904, 2843, 43907, 43908, 47911, 7516, 47907, 2927, 47908, 3546, 36689, 7390, 36695, 36697, 7416, 8035, 36701, 34460, 34760, 34764, 36685, 43958, 36687, 36707, 36691, 36709, 36693, 36699, 36703, 36731, 36705, 36765, 36711, 36715, 36743, 36747, 36733, 38035, 36739, 36745, 36753, 36755, 43900, 36761, 36763, 36777, 43902, 36781, 36789, 36793, 47905, 37579, 37982, 38034, 38036, 38037, 38039, 43899, 43903, 44484, 47277, 47904, 47906, 47910, 49131, 6274, 1726, 2653, 49628, 2655, 50177, 2656, 2657, 50044, 50066, 2663, 2784, 3651, 3885, 4600, 4987, 5436, 5437, 5439, 7127, 7158, 7738, 5433, 5434, 49632, 49634, 49637, 34132, 49638, 34147, 49645, 49635, 49639, 34153, 49650, 49651, 49656, 40979, 49659, 40982, 49661, 40983, 49664, 43858, 49665, 43964, 49666, 43965, 49670, 44229, 44231, 49668, 49672, 44868, 49674, 44869, 44870, 44871, 49662, 44872, 49630, 44873, 49641, 44874, 49642, 44875, 49654, 46067, 49631, 46068, 46069, 46552, 49633, 46553, 49643, 47027, 49636, 47028, 49646, 47029, 49647, 47030, 49649, 47031, 47032, 47634, 49652, 49626, 49629, 6220, 50122, 1466, 50049, 44614, 2337, 2338, 2339, 2745, 2860, 3071, 3082, 3421, 5146, 5904, 5905, 5907, 5908, 5909, 5910, 6239, 6240, 6818, 7081, 7269, 7905, 8054, 8058, 8061, 3905, 4945, 40080, 6726, 6517, 37079, 37078, 34307, 34773, 37603, 37604, 37605, 40098, 40102, 40094, 40105, 40095, 40107, 40096, 40108, 40097, 40099, 40100, 40103, 40104, 40106, 40109, 40573, 45850, 40576, 45851, 40577, 40580, 40584, 45853, 41102, 45854, 45858, 41155, 45859, 41156, 45862, 41157, 45863, 45865, 46382, 43956, 44253, 45848, 45849, 45852, 45855, 45856, 45857, 45860, 45861, 45864, 46370, 46372, 46390, 46374, 46376, 46378, 46380, 46384, 46396, 46386, 46388, 46392, 46394, 48717, 48922, 45514, 1734, 50240, 44507, 50230, 50169, 5978, 1445, 36985, 36982, 2743, 3060, 36988, 4383, 5181, 5184, 5188, 5189, 5194, 5195, 5975, 7988, 36987, 47691, 34470, 34731, 1737, 37606, 37607, 37608, 37609, 37610, 37611, 37613, 1736, 47693, 40547, 40549, 40551, 40553, 40557, 40559, 40561, 40563, 40565, 40567, 40569, 40571, 40573, 40580, 40584, 41099, 41100, 41101, 41104, 41105, 41106, 41107, 41108, 41109, 41110, 41111, 41114, 41112, 41117, 41113, 44234, 44235, 41115, 41118, 43959, 44236, 44232, 44237, 44233, 44644, 44238, 44239, 44240, 44241, 44508, 44781, 45517, 45520, 46077, 47389, 48448, 48481, 48717, 48788, 50213, 37565, 37564, 37566, 37567, 37568, 37569, 37570, 37571, 37572, 37573, 37574, 37575, 37576, 37577, 37578, 37580, 37581, 37582, 37583, 37584, 37585, 37587, 37588, 37590, 37591, 37592, 37593, 37595, 37598, 37599, 37601, 42980, 38785, 38744, 38745, 38746, 38747, 38748, 38759, 38773, 38711, 38712, 38713, 38717, 38719, 38720, 38721, 38722, 38723, 38724, 38725, 38726, 38727, 38729, 38730, 38731, 38732, 38733, 38734, 38735, 38736, 38737, 38738, 38739, 38740, 38741, 38742, 38743, 38680, 38681, 38683, 38699, 38708, 38709, 38710, 38163, 38171, 38165, 38167, 38169, 38173, 38175, 38177, 38179, 38181, 38183, 38185, 38187, 38191, 38189, 38193, 38236, 38671, 38672, 38673, 38674, 38676, 38677, 7344, 39237, 37133, 37134, 38033, 40640, 40641) AND t.active=1 AND ((colors.color_id='4')) GROUP BY t.item_id ORDER BY d.popularity DESC 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)