SELECT SQL_CALC_FOUND_ROWS wp_posts.post_name, wp_posts.ID, wp_posts.post_title, wp_postmeta.meta_value, CAST(wp_postmeta_1.meta_value AS UNSIGNED) AS price, CAST(wp_postmeta_2.meta_value AS UNSIGNED) AS sale_price, CAST(wp_postmeta_4.meta_value AS UNSIGNED) AS stock ,wp_postmeta_3.meta_value as order_menu FROM wp_term_relationships INNER JOIN wp_posts ON wp_term_relationships.object_id = wp_posts.ID AND wp_posts.post_status = 'publish' AND wp_posts.post_type = 'product' INNER JOIN wp_terms INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id AND wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id INNER JOIN wp_postmeta ON wp_postmeta.post_id = wp_posts.ID AND wp_postmeta.meta_key = '_product_attributes' INNER JOIN wp_postmeta wp_postmeta_1 ON wp_postmeta_1.post_id = wp_posts.ID AND wp_postmeta_1.meta_key = '_regular_price' INNER JOIN wp_postmeta wp_postmeta_2 ON wp_postmeta_2.post_id = wp_posts.ID AND wp_postmeta_2.meta_key = '_price' LEFT JOIN wp_postmeta wp_postmeta_3 ON wp_postmeta_3.post_id = wp_posts.ID AND wp_postmeta_3.meta_key = concat('_reorder_term_product_cat_', wp_terms.slug) LEFT JOIN wp_postmeta wp_postmeta_4 ON wp_postmeta_4.meta_key = '_stock' AND wp_postmeta_4.post_id = wp_posts.ID LEFT JOIN wp_postmeta sku ON sku.meta_key = '_sku' AND sku.post_id = wp_posts.ID WHERE true AND (wp_terms.slug IN ('hity') OR wp_terms.term_id IN ('hity')) AND wp_posts.ID NOT IN (44095,25142,25187,25190,25198,25199,25200,25201,5913,24829,8887,8887,8851,8843,14672,14656,14652,14636,14632,14628,24808,10441,10433,10429,10425,10393,10373,10373,10357,10333,10329,10325,14289,14269,14265,12260,12180,7424,7412,7408,7392,7380,7376,7344,7336,7312,13572,13568,13568,13540,13536,13532,13520,13520,13512,13508,13480,13476,13468,13464,13460,13460,24760,11435,11399,11379,11351,11347,11315,11307,11307,11303,11295,11259,11247,11239,11235,11235,11219,11211,11211,24512,9845,9837,9829,9757,9733,24669,24589,24589,7044,7036,10285,10281,10265,10257,10253,10237,10233,10229,10225,10221,13679,13663,23481,23472,23471,23463,23462,23456,23447,23447,23438,23436,23419,23402,23391,23391,23390,23381,19595,19587,19583,19579,19575,19571,19567,19563,19559,19555,19551,19547,19543,19539,19535,19531,19527,19519,19515,19507,19503,19499,19491,19487,19483,19479,19475,9989,9969,9949,9945,9941,9933,9917,9913,9913,9905,9897,9893,9877,16576,16572,16564,16556,16536,16532,16528,16520,16520,16492,16476,16468,16460,16456,16444,16440,16432,16428,16424,5925,5861,5849,5841,5793,24581,24581,5092,5096,5084,5080,5072,5040,5036,5028,5028,5020,5016,5004,5000,4996,4992,4984,4980,5252,5252,5240,5224,5216,5212,5208,5204,5204,5200,5196,5192,5188,5188,5184,5184,5160,5156,5152,5144,5140,5136,5124,5108,5104,5104,5100,19441,19437,19433,19429,5549,5545,5541,5529,5513,5509,5493,5477,5473,5469,5465,5457,5441,5437,5429,5425,5425,5421,22564,16692,16688,16680,16676,16672,16668,16660,16656,16652,16644,16636,16632,16628,16608,16608,16596,16592,16588,5741,5733,5729,5725,5717,5713,5689,5689,5685,5673,5649,5645,5637,24708,23837,23830,23829,23824,23822,23815,23814,23809,23808,23799,23798,23771,23764,23763,23751,23743,23742,23741,23727,23715,6834,24654,24647,24599,22293,22272,22271,22269,22266,22249,22248,22215,21820,21816,21813,21809,21808,21807,21805,21804,21780,21774,21768,21758,21757,21747,21741,21740,21734,21725,21711,21711,21708,21705,21692,21688,21688,21677,21674,21670,21667,21661,21658,21655,21652,21649,21646,21643,21632,15919,15919,15867,15839,15759,15759,24555,24548,15375,15331,7974,7898,7822,7818,7814,7802,7798,7786,7782,15707,15659,15655,15647,15615,15611,15559,15555,15535,19407,10703,10691,10687,10663,10659,10655,10651,10647,10635,10631,10619,10619,10611,10595,10579,10575,10575,10571,10567,10559,10551,10547,10539,10535,10531,10527,10523,10519,10515,10511,10507,10503,10483,10475,10471,10463,15067,15059,15047,15039,15035,15003,14979,14971,14955,14947,14895,14887,14867,15275,15267,15259,15219,15215,15211,15195,15191,15171,15163,15151,15147,15135,15115,15111,15107,12481,12473,12465,12461,12457,12453,12449,12437,12429,12425,12421,12417,12413,12409,12405,12401,12393,12389,12369,12365,12361,12329,12329,12317,12313,12309,12309,12305,12297,12160,12156,12152,12148,12144,12136,12132,12120,12116,12104,12100,12096,12092,12088,12084,12080,12076,12072,12068,12064,12056,12052,12048,12040,12036,12032,12028,12024,12020,12016,12012,12008,12004,12000,11996,11992,11988,11984,11980,11972,11968,11964,11960,11956,11619,11603,11599,11587,11579,11575,11571,11563,11555,11535,11531,11519,11515,11511,11499,11495,11491,11487,11483,11471,11467,11463,11459,11455,11451,11447,11443,11439,13034,13026,12926,11820,11800,11792,11759,11751,11743,11747,11739,11735,11731,11727,11723,11719,11690,11685,11675,11655,11651,11195,11191,11179,11167,11159,11155,11151,11147,11139,11135,11131,11123,11115,11111,11103,11099,11095,11083,11075,11063,11059,11055,11051,11047,11043,11035,11031,11015,11011,11007,10999,10991,10983,10979,10181,10177,10173,10169,10165,10161,10153,10149,10145,10141,10129,10093,10089,10081,10077,10077,10073,10037,10029,10025,10025,10021,10017,10005,10005,14496,14524,14544,13212,13222,13232,13237,13247,13252,13257,13262,13267,13272,13277,13282,13287,24545,24547,13291,13296,13306,13311,13316,13321,13326,13336,13341,13351,13366,13371,13376,13381,13386,13391,13396,13401,13406,13411,13416,13421,13431,13436,13441,13446,13451,43860,26253,26238,26236,26235,26221,26175,26172,26158,26155,26130,25196,25207,25209,25215,25216,25217,25219,25220,25221,25223,43703,43702,43701,43700,43699,43694,43693,43691,43690,43689,43688,43661,36861,36861,36860,36859,36858,36847,36847,6045,6041,6037,5945,44919,44918,44917,44916,44914,44912,44911,44910,44909,44908,44907,44906,44905,44904,44903,44902,44898,44897,44894,44893,44892,44891,44890,44889,44888,44887,44806,25452,25472,25493,25523,13619,13623,13631,13671,12488,12500,12527,12530,12533,12560,12566,12569,12578,12581,12584,29993,29846,22481,30266) GROUP BY sku.meta_value ORDER BY order_menu+0 DESC,sale_price ASC LIMIT 200, 100