Guest User

Untitled

a guest
Jan 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. SELECT array_to_json(array_agg(outer))
  2. FROM
  3. (
  4. SELECT
  5. eCPRefAuth_Action_Code_Lookup_Category2
  6. (
  7. SELECT array_to_json(array_agg(Result))
  8. FROM
  9. (
  10. SELECT
  11. eCPRefAuth_Action_Code_Lookup_Category
  12. ,json_agg(
  13. row_to_json(
  14. (
  15. SELECT t FROM
  16. (
  17. SELECT eCPRefAuth_Action_Code_Lookup_Code, eCPRefAuth_Action_Code_Lookup_Desc
  18. ORDER BY eCPRefAuth_Action_Code_Lookup_Seq_level2
  19. ) AS t(eCPRefAuth_Action_Code_Lookup_Code, eCPRefAuth_Action_Code_Lookup_Desc)
  20. )
  21. )
  22. ) AS available_codes
  23. FROM tbl_eCPRefAuth_Action_Code_Lookup
  24.  
  25. GROUP BY eCPRefAuth_Action_Code_Lookup_Category, eCPRefAuth_Action_Code_Lookup_Seq_level1
  26. ORDER BY eCPRefAuth_Action_Code_Lookup_Seq_level1
  27. ) AS Result
  28. )
  29. FROM tbl_eCPRefAuth_Action_Code_Lookup
  30. )as outer
Add Comment
Please, Sign In to add comment