Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. select *
  2. from hotel_region_autocomplete
  3. where
  4. region_id in (
  5. select distinct(region_id) from
  6. (select distinct(region_id)
  7. FROM
  8. (select region_id, region_name from hotel_region_autocomplete where (region_group = 'C' or region_group = 'A') and suggestion_name REGEXP CONCAT('[[:<:]]', "Indonesia", '[[:>:]]')
  9. and region_id not in (select region_id from hotel_ean_city_code_region_id_mapping)) as cmd
  10. where cmd.region_id not in (select temp.region_id from
  11. (select * from hotel_region_autocomplete where (region_group = 'C' or region_group = 'A') and suggestion_name REGEXP CONCAT('[[:<:]]', "Indonesia", '[[:>:]]')
  12. and region_id not in (select region_id from hotel_ean_city_code_region_id_mapping)) as temp
  13. join
  14. (select m.region_id, h.child_ids from hotel_ean_child_regions as h
  15. join hotel_ean_city_code_region_id_mapping as m on h.region_id = m.region_id) as twd
  16. on twd.child_ids REGEXP CONCAT('[[:<:]]',temp.region_id, '[[:>:]]'))) as indo
  17. join (select child_ids from hotel_ean_child_regions where region_id = '602651') as child
  18. on child.child_ids NOT REGEXP CONCAT('[[:<:]]',indo.region_id, '[[:>:]]')
  19. where indo.region_id != '602651');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement