Created
April 24, 2025 00:50
-
-
Save diego-lipinski-de-castro/fb4749d6653343f4c5aab75858d63cec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select `sites`.*, (select count(*) from `views` where `sites`.`id` = `views`.`site_id`) as `views_count`, (select count(*) from `orders` where `sites`.`id` = `orders`.`site_id` and `orders`.`deleted_at` is null) as `orders_count`, (select count(*) from `clients` inner join `favorites` on `clients`.`id` = `favorites`.`client_id` where `sites`.`id` = `favorites`.`site_id`) as `favorites_count`, (select count(*) from `clients` inner join `interests` on `clients`.`id` = `interests`.`client_id` where `sites`.`id` = `interests`.`site_id`) as `interests_count` from `sites` where `status` = 'APPROVED' and `url` like '%1001%' and ((exists (select * from `offers` where `sites`.`id` = `offers`.`site_id` and exists (select * from `types` inner join `offer_type` on `types`.`id` = `offer_type`.`type_id` where `offers`.`id` = `offer_type`.`offer_id` and `offer_type`.`sale_coin` = 'BRL' and `offer_type`.`sale` >= 0 and `offer_type`.`sale` <= 570739429.26 and `type_id` = '9' and `types`.`deleted_at` is null))) or (exists (select * from `offers` where `sites`.`id` = `offers`.`site_id` and exists (select * from `types` inner join `offer_type` on `types`.`id` = `offer_type`.`type_id` where `offers`.`id` = `offer_type`.`offer_id` and `offer_type`.`sale_coin` = 'EUR' and `offer_type`.`sale` >= 0 and `offer_type`.`sale` <= 88237911.762 and `type_id` = '9' and `types`.`deleted_at` is null))) or (exists (select * from `offers` where `sites`.`id` = `offers`.`site_id` and exists (select * from `types` inner join `offer_type` on `types`.`id` = `offer_type`.`type_id` where `offers`.`id` = `offer_type`.`offer_id` and `offer_type`.`sale_coin` = 'USD' and `offer_type`.`sale` >= 0 and `offer_type`.`sale` <= 99999900 and `type_id` = '9' and `types`.`deleted_at` is null))) or (exists (select * from `offers` where `sites`.`id` = `offers`.`site_id` and exists (select * from `types` inner join `offer_type` on `types`.`id` = `offer_type`.`type_id` where `offers`.`id` = `offer_type`.`offer_id` and `offer_type`.`sale_coin` = 'GBP' and `offer_type`.`sale` >= 0 and `offer_type`.`sale` <= 75363924.636 and `type_id` = '9' and `types`.`deleted_at` is null)))) and `da` >= 0 and `da` <= 96 and `dr` >= 0 and `dr` <= 96 order by `url` asc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment