Guest User

Untitled

a guest
Oct 17th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. CREATE VIEW rep_ops_verification_basis as (
  2. SELECT
  3. ap.id "ap",
  4. p.id "p",
  5. ao.id "id",
  6. p.address_city_code,
  7. p.verification_internal_verified "verified",
  8. IF(ag.roles in ('ROLE_PHOTOGRAPHY, ROLE_STAFF','ROLE_STAFF,ROLE_PHOTOGRAPHY'),1,0) "photography",
  9. IF(p.`has_video` = 1 OR p.video_url is not null,1,0) "video"
  10.  
  11. FROM prod_reporting.accommodation_provider ap
  12. INNER JOIN prod_reporting.accommodation_provider_admin ap2
  13. ON ap.id = ap2.id
  14. INNER JOIN prod_reporting.property p
  15. ON ap.id = p.accommodation_provider_id
  16. INNER JOIN prod_reporting.accommodation_offer ao
  17. ON p.id = ao.property_id
  18. LEFT JOIN prod_reporting.agency_staff ag
  19. ON ag.id = p.verification_internal_verified_by
  20. WHERE ap.is_test = 0
  21. AND ao.published = 1
  22. AND ap.out_of_platform = 0
  23. AND p.out_of_platform = 0
  24. AND ap.account_management_key_account = 0
  25. AND ao.contract_exclusive = 0
  26. GROUP BY ao.id);
Add Comment
Please, Sign In to add comment