SELECT p.id FROM `convert_convert`.`products` p LEFT JOIN `convert_convert`.`products_pricing` AS `pp` ON `pp`.`pid` = `p`.`id` LEFT JOIN `highwaygroup`.`currency` AS `c1` ON `pp`.`cost_currency` = `c1`.`code` LEFT JOIN `highwaygroup`.`currency` AS `c2` ON `pp`.`sales_currency` = `c2`.`code` WHERE p.id IN ('38', '44', '45', '47', '53', '54', '65', '68', '71', '74', '75', '77', '81', '82', '86', '87', '88', '89', '90', '91', '92', '94', '95', '143', '176', '177', '178', '179', '189', '191', '192', '193', '194', '195', '206', '210', '211', '215', '216', '220', '228', '233', '235', '236', '238', '240', '248', '251', '256', '257', '259', '260', '267', '269', '270', '272', '281', '285', '286', '287', '288', '308', '314', '317', '326', '338', '344', '364', '377', '380', '392', '393', '394', '401', '402', '403', '404', '405', '417', '420', '429', '430', '431', '432', '433', '438', '442', '443', '447', '452', '459', '464', '470', '473', '490', '492', '493', '500', '504', '508', '513', '514', '516', '520', '537', '538', '539', '540', '541', '542', '544', '545', '547', '548', '549', '553', '554', '556', '560', '561', '563', '564', '594', '604', '611', '612', '617', '619', '633', '644', '645', '646', '647', '648', '660', '661', '690', '691', '694', '695', '702', '706', '709', '710', '722', '728', '730', '734', '738', '739', '740', '741', '743', '745', '748', '749', '750', '751', '753', '762', '763', '764', '767', '775', '780', '781', '783', '784', '786', '787', '788', '789', '796', '807', '824', '826', '827', '833', '855', '857', '860', '862', '866', '867', '872', '873', '877', '881', '885', '886', '887', '890', '891', '895', '897', '899', '900', '901', '902', '905', '906', '921', '924', '925', '926', '928', '930', '938', '971', '972', '975', '987', '989', '990', '991', '998', '15002', '15003', '15015', '15039', '15040', '15041', '15047', '15048', '15053', '15056', '15057', '15058', '15067', '15071', '15072', '15075', '15076', '15081', '15084', '15098', '15099', '15106', '15109', '15110', '15111', '15112', '15114', '15125', '15126', '15128', '15129', '15130', '15144', '15145', '15155', '15173', '15175', '15179', '15180', '15181', '15183', '15188', '15191', '15192', '15196', '15197', '15200', '15208', '15209', '15217', '15218', '15220', '15227', '15240', '15247', '15249', '15317', '15326', '15327', '15328', '15330', '15333', '15334', '15335', '15340', '15349', '15364', '15370', '15376', '15381', '15389', '15393', '15395', '15402', '15409', '15420', '15421', '15422', '15431', '15445', '15455', '15463', '15464', '15465', '15477', '15482', '15483', '15523', '15573', '15598', '15599', '15612', '15630', '15638', '15639', '15640', '15641', '15642', '15643', '15644', '15645', '15687', '15720', '15721', '15722', '15723') ORDER BY IF(`p`.`special_flag` = 'y' AND (`p`.`special_expiry` > '2024-05-05 00:00:00' OR `p`.`special_expiry` = '0000-00-00 00:00:00'), `p`.`special_priceaud`,`pp`.`sales_price_au`) ASC