Ошибка в SQL-запросе: select * from (select * from (select ID_GOOD, good_url, good_visible, count(ID_GOOD) as cnt from cprice_goods natural join cprice_goods_features where good_visible=1 && good_deleted=0 && ((ID_FEATURE=86 && goodfeature_value=В®=) || ( ID_FEATURE=92 && (goodfeature_value in (0,3160,3023,5309,2918,5627,2984,2946,5854,5862,5998,5853,3002,6576,6590,6982,2943,6111) ||goodfeature_value in (0,3183,2903,3323,3087,3372,3052,5657,2927,3023,3085,3072,6512,2943,6122,3202) ||goodfeature_value in (0,2903,2908,2912,2914,2916,2918,2922,2927,2929,2931,2935,2938,2939,2941,2948,2969,2978,2980,2984,2991,2993,2995,2998,3001,3004,3023,3030,3031,3032,3033,3046,3054,3061,3062,3064,3065,3073,3081,3087,3088,3095,3107,3119,3140,3177,3227,3236,3279,3324,3383,3442,4129,5300,5308,5309,5862,5969,5948,5957,6015,6064,6111,6118,6121,6158,6170,6177,6181,6183,6187,6259,6261,6263,6315,6429,6435,6448,6528,6576,6590,6830,6982,7116,7153,7174,7352,7354,5954,7357,7365,7368,7370,7372,7378,7380,8301) ))) group by ID_GOOD) as tbl where cnt=2) as t1 inner join cprice_goods_features as t2 on t1.ID_GOOD=t2.ID_GOOD inner join cprice_rubric_goods as t3 on t1.ID_GOOD=t3.ID_GOOD WHERE t3.ID_RUBRIC<>126 && t3.ID_RUBRIC<>127 && t3.ID_RUBRIC<>117 && t2.ID_FEATURE=226 order by CAST(t2.goodfeature_value AS decimal(10,5)) DESC, t2.ID_GOOD : 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 '®=) || ( ID_FEATURE=92 && (goodfeature_value in (0,3160,3023,5309,2918,5627,298' at line 2