Guest User

Untitled

a guest
Jan 20th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. SELECT
  2. AN.*,
  3. CASE
  4. WHEN AN.area_type ilike 'city' THEN CT.city
  5. WHEN AN.area_type ilike 'state' THEN ST.State
  6. WHEN AN.area_type ilike 'country' THEN CN.country
  7. WHEN AN.area_type ilike 'region' THEN RJ.region
  8. END as area_name
  9. FROM
  10. area_notifications AN
  11. LEFT JOIN
  12. cities CT
  13. ON
  14. CT.city_id = AN.area_id
  15. LEFT JOIN
  16. states ST
  17. ON
  18. ST.state_id = AN.area_id
  19. LEFT JOIN
  20. countries CN
  21. ON
  22. CN.country_id = AN.area_id
  23. LEFT JOIN
  24. regions RJ
  25. ON
  26. RJ.region_id = AN.area_id
  27. WHERE
  28. AN.is_deleted = FALSE
Add Comment
Please, Sign In to add comment