QUERY: SELECT p.products_id, p.products_model, p.label_ids, p.main_category, p.products_ean, p.products_fsk18, p.products_quantity, p.products_quantity_min, p.products_quantity_step, p.products_price, p.products_price_small_opt, p.products_price_opt, p.products_purchase_price, p.small_opt_purchase_price, p.count_small_opt_purchase_price, p.count_opt_purchase_price, p.opt_purchase_price, p.postavshik, p.suplier_catalog_id, p.postavshik_comment, p.name_catalog_id, p.products_tax_class_id, p.products_image, p.products_vpe, p.products_vpe_status, p.products_vpe_value, p.products_currency, p.products_page_url, p.video, p.show_video, pd.products_short_description, p.rev_total, p.rev_rating, pd.products_name, p.products_ordered, pd.products_short_description, s.status, IF(s.status, s.specials_new_products_price, 0) as specials_new_products_price, m.manufacturers_name, m.manufacturers_id FROM products AS p LEFT JOIN products_description AS pd ON (p.products_id = pd.products_id) LEFT JOIN manufacturers AS m ON (p.manufacturers_id = m.manufacturers_id) LEFT JOIN specials AS s on p.products_id = s.products_id LEFT JOIN products_to_categories as p2c2 ON (p2c2.products_id=p.products_id) LEFT JOIN categories as c ON (c.categories_id=p2c2.categories_id) WHERE p.products_status = 1 AND c.categories_status = 1 AND pd.language_id = '1' AND p.products_id IN(8595029,8595102,8595103,8595104,7201747,8628249,7201875,7202035,8559808,5654555,5654577,5654581,5654610,7202529,7202677,7065965,7065974,7066121,10929249,8573261,3227542,8629781,8573334,10200001,7200653,3927826,8067914,8627254,7200933,7201031,3238215,7201268,8594733,8594779,8556303,8556311,8556313,8556315,8556316,10195119,7198687,7198694,8908511,7198703,7198713,7198726,7198744,7198745,7198765,7198833,8625411,8625412,7199088,7064473,7199332,8909159,7199418,7199425,7199426,10101453,7199593,7199661,7199663,10101564,10196148,7199771,8626171,7199817,7199877,7199878,7199976,7199977,10196489,7200172,8626613,7200281,7200282,8910239,8910240,8910241,7200474,7200506,7197625,7197674,7197675,7197701,7197714,7197857,7197928,7197929,7197930,7197931,7197932,7197933,7197934,7197935,7197936,7197937,7197938,7197939,7197940,7197941,8624372,7197999,7198001,7198016,7198037,8555900,7198215,8555923,7198237,7198238,7198239,7198240,7198241,7198242,7198243,7198244,7198245,7198246,7198247,7198248,7198249,7198250,7198251,7198252,7198253,7198254,7198255,7198256,7198257,7198258,7198259,7198278,7198282,7198394,8861536,7198427,7198467,7198468,8556283,8905482,8905491,8905492,8905493,8905494,8905495,10944508,8905755,7196144,7196346,7196347,10837864,3923519,7196402,10837925,10837926,10837927,10837928,10837929,8554303,8906605,8906623,8906680,7196931,7196932,7196933,7196934,7196935,7196936,7196950,7196951,7196952,7196953,7196954,7196955,7196956,7196957,7196958,7196959,7196960,7196961,7196962,7196963,7196964,7196965,7196966,7196967,7196968,7196969,7196970,7196971,7196972,7196973,7196974,7196975,7196976,7196977,7196978,7196979,7196980,7196981,7196982,7196983,7196984,7196985,7197064,7197065,7197066,7197067,8906929,8906930,8906931,8906932,8613714,8906938,8906939,8906940,8906943,8906944,8554833,8906947,8906948,8906949,8860404,10838801,7197307,7197309,7197311,7197314,10838826,7197393,10838913,7197420,10838964,10190187,3581888,10425940,10425941,10425944,9217251,10426010,10426012,10426014,10426019,10426152,10623494,10623605,10623606,10426412,8610914,8611324,8552639,8552692,8552693,8552694,8552695,8904862,8905047,8905052,8905238,8905245,8905246,8905274,10622017,10622028,10622030,10622040,10617045,10622258,10622264,10622265,10622267,10622268,10617319,10622360,10622402,10622408,10622431,10622447,10622514,10622516,10622518,10622523,10425353,10425484,10425487,10425518,10189898,10425574,10425575,10190018,10615063,8569935,8630173,10615232,10615335,10615519,10615570,10615571,10615774,10615786,10615787,10615925,10616015,10616048,10616049,10616062,10616064,3228908,3228993,3228998,10188367,10188375,10188379,10188380,10188381,10188382,10188384,3229182,10431337,8575003,10188602,10188603,10188606,10188607,8583438,10616888,10559291,10614239,6669823,6670043,10614928,10614929,10611964,10612086,9187451,10612179,10612283,10612284,10612285,10612286,10612429,10612430,10612464,10612465,10612488,10612489,10612491,10612492,10612498,8851690,10612528,10612529,10612530,10612531,10612532,10612533,10612534,10612535,10612536,10612537,10612538,10612539,10612540,10612541,10612542,10612543,10612544,10612545,10612546,10612547,10612548,10612549,10612550,10612551,10612552,10612553,10612554,10612555,10612556,10612557,10612558,10612582,10612585,10612587,10612588,10612592,10612603,10612611,10612612,10612613,10612614,10612620,10612623,10612645,10612660,8851838,8851839,8566519,10612679,10612684,10612686,10612693,10612694,10612695,10612696,10612697,10612698,10612700,10612705,10612865,10612873,10612874,10612937,10612950,10612951,10612960,8852130,10612961,10612968,10612969,10612984,10613168,10613173,10613223,10613235,10613237,8852545,10613466,8852692,8852698,8852757,8852758,10613689,10613691,10613711,10613717,10613741,10613744,8853040,8853041,9911525,10117518,7055490,10117529,9911563,9911567,7055534,9911585,10117661,10117708,10117709,10117710,10515335,6673739,6673747,9911759,7055725,9911768,9911769,10117818,9169669,9911918,9169712,7015386,7015387,10118001,10118002,10118011,9169866,9912080,9912104,6674109,9912117,9169910,6674136,9912161,6674173,6674174,10118179,9912195,9912201,6674223,10118341,8849983,9912374,9912376,9912379,9912380,9912381,9912382,9912383,9912384,9912385,9912386,9912387,9912388,9912389,10118406,9912486,7015968,7015969,7015970,7015971,7015972,7015973,7015974,7015975,7015976,7015977,10118522,9912575,10118573,9912684,8850369,8850370,8850371,8850385,8850386,8850387,8850426,8850427,8850444,8850445,8850446,8850447,8850448,8850486,8850489,8850490,8850500,8850533,8850534,8850586,9912975,9913033,9913119,9913195,8552322,8552323,8552324,8552325,8552329,8552332,8552348,8552358,8552359,8552360,8552361,8552362,8552363,8552364,8552365,8552366,8552367,8552368,8552369,8552370,9913291,9913292,9913297,6672520,6672522,6672523,9168335,9168393,9910608,6672660,6672663,6672666,6672668,6672676,6672694,6672695,6672696,10418420,6672721,10417439,10417440,10418465,9910843,9168677,9168678,10418594,10418595,9910897,9910898,10418606,10418607,7054861,10418637,10418638,10418639,10418661,10418662,9168758,9168765,10418681,9168857,9168873,6673091,10418851,10418852,10418853,10418854,6673155,10416935,10416936,10416937,10416938,10416939,9911258,10117387,10117388,9169228,6673480,6673481,6673482,6673483,6673484,6673485,10470905,8549505,8549506,8549508,9166507,9166508,9166510,9166511,10467240,10467260,10467261,10467262,10467263,10467264,10467265,10467266,10467267,10467268,10467269,10467270,10467271,10467272,10467273,10467274,10467275,10467276,10467277,10467278,10467279,10467280,10467281,10467282,10467283,10467284,10467285,10467286,10467287,10467288,10467289,10467290,10467291,10467292,10467293,10467294,10467295,10467296,10467297,10467298,10467299,10467300,10467301,10467302,10467303,10467304,10467305,10467306,10467307,10467308,10467309,10467310,10467311,10467312,8549913,8550017,8550043,9175061,10469655,10469659,10467705,10467718,10467760,9183256,9167297,10469870,10469871,9167344,8550591,9167502,976356,10470178,10468178,976476,976489,976490,976495,10468398,10468704,10468705,9168135,10468706,10468707,10468708,10468709,10468710,10468711,10468712,10468713,10468714,10468715,10468716,10468717,10468718,9168194,10470805,10159547,10184560,10883612,10883687,10883932,10889090,10884156,10889243,10889244,10889245,10884284,10884345,10884361,10884362,10899536,10884537,10899562,10899563,10884603,10884649,10884650,10884680,10884707,10889798,10875002,10890133,10885229,10885240,10885241,10885242,10885243,10885259,10885315,10887579,7000826,10887776,10887777,10887831,10887832,10887833,10887834,10887835,10887845,10888033,10888034,10888040,10888042,10888052,10888061,10888114,10888136,10888139,10883215,10888313,10888316,10888320,10888361,10893380,10893381,10888404,10888458,10883474,10885512,10885595,10161662,10885710,10885875,10161956,10161975,10162005,10162006,10162007,10162009,10162010,10886007,10658522,10881551,10886868,10881994,10881999,10882083,10882084,10882085,10882086,10882087,10882100,10877126,10887170,10897240,10887265,10887397,10602077,10602080,10602140,10602145,10602147,10602158,10602163,10602179,10602180,10602197,10602210,10602213,10602218,10602482,10602499,10602536,10602570,10602576,10602591,10602615,10602617,10602675,10602679,10602709,10647231,10647232,10647393,10653470,10647505,10647612,10603683,10603694,10585350,10601480,10601525,10601622,10604658,10604661,10601667,10601678,10604695,10601723,10601725,10601757,10601793,10601795,10601860,10601880,10601891,10601895,10601905,10601926,10601955,10538788,10524916,10508319,10508501,10508502,10508503,10507735,10507744,10507745,10507746,10425195,10425200,10425204,10425209,10482907,10482908,10411281,10482936,10482955,10482964,10413313,10411370,10411372,10413406,10413414,10483071,10413426,10483095,10409488,10409489,10413491,10413511,10413512,10411557,10488271,10413738,10413743,10477410,10477411,10413768,10413769,10413770,10413771,10413772,10413773,10413774,10413775,10413776,10413777,10413778,10413779,10413780,10413781,10413782,10413783,10413784,10413785,10413786,10413787,10413788,10413789,10413790,10413791,10413792,10413793,10413794,10413795,10413805,10413816,10477496,10477497,10411848,10411883,10414036,10410070,10410123,10412246,10490913,10490914,10490915,10412503,10412505,10412512,10489169,10474298,10474299,10474300,10474301,10474302,10474303,10412677,10414733,10410769,10414816,10414817,10406886,10406887,10408974,10408975,10408976,10409027,10409028,10409029,10409030,10409031,10409032,10409033,10409034,10409035,10409036,10409037,10409038,10409039,10409040,10409041,10409042,10409043,10409044,10409045,10409046,10409047,10409048,10409049,10409050,10411105,10411106,10411107,10411108,10411172,10411173) GROUP BY p.products_id ORDER BY CASE WHEN products_price = 0 THEN 99999999 WHEN products_price > 0 THEN products_price END asc ,p.products_specials desc
ERROR: Unknown column 'p.products_specials' in 'order clause'