Query: | SELECT `T1`.*, `T1`.`price` as `Min_price`, `T3`.`Path` AS `Path`, `T3`.`Key` AS `Key`, `T3`.`Type` AS `Listing_type`, `T3`.`Parent_keys`, IF(
`T1`.`Featured_date` <> '0000-00-00 00:00:00',
IF(`T1`.`Position` <> '99999',
99999-`T1`.`Position`,
(FLOOR(RAND() * 500) + 1)),
'0') `Featured` FROM `fl_listings` AS `T1` LEFT JOIN `fl_categories` AS `T3` ON `T1`.`Category_ID` = `T3`.`ID` WHERE `T1`.`Status` = 'active' AND `T1`.`country` = 'countries_moskva' AND `T1`.`Featured_date` <> '0000-00-00 00:00:00' AND `T3`.`Type` = 'girls' AND `T1`.`Sub_status` <> 'invisible' ORDER BY `T1`.`Position` ASC, `T1`.`Last_show` ASC, RAND() LIMIT 10 |