Advertisement
VoronVU

ORACLE, SELECT, Строки в столбцы

Feb 16th, 2015
778
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.   WMSYS.WM_CONCAT(t.ALGORITM_ID) AS emp
  3. FROM
  4.   EMT_ALGORITM t
  5. WHERE
  6.   t.ALGORITM_TYPE_ID = 2
  7. GROUP BY
  8.   t.ALGORITM_TYPE_ID
  9. -----------------------------
  10. SELECT
  11. t.dep,
  12. wmsys.wm_concat(t.emp) AS emp
  13. FROM
  14. (SELECT 1 dep, 'A' emp FROM dual
  15. UNION
  16. SELECT 1 dep, 'B' emp FROM dual
  17. UNION
  18. SELECT 1 dep, 'C' emp FROM dual
  19. UNION
  20. SELECT 1 dep, 'D' emp FROM dual
  21. UNION
  22. SELECT 2 dep, 'E' emp FROM dual
  23. UNION
  24. SELECT 2 dep, 'F' emp FROM dual
  25. UNION
  26. SELECT 3 dep, 'G' emp FROM dual
  27. UNION
  28. SELECT 3 dep, 'H' emp FROM dual
  29. UNION
  30. SELECT 4 dep, 'J' emp FROM dual
  31. )t
  32. GROUP BY t.dep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement