daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Oct 13th, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT LEFT(COLUMN_NAME, LENGTH(COLUMN_NAME) - 1)
  2. FROM (
  3.     SELECT COLUMN_NAME + ', '
  4.     FROM information_schema.columns
  5.     WHERE  table_name IN ('Employee')
  6.     FOR XML PATH ('')
  7.   ) c (COLUMN_NAME)
  8.    
  9. $ ./install testdb
  10. CREATE AGGREGATE
  11. Created uda
  12. Done
  13. CREATE AGGREGATE
  14. Created uda
  15. Done
  16.    
  17. TESTDB.ADMIN(ADMIN)=> select * from test_gc order by col1, col2;
  18.  COL1 | COL2
  19. ------+------
  20.     1 | A
  21.     1 | B
  22.     1 | C
  23.     2 | C
  24.     2 | D
  25.     2 | E
  26. (6 rows)
  27.  
  28. TESTDB.ADMIN(ADMIN)=> select col1, group_concat(col2,',') from test_gc group by col1 order by col1;
  29.  COL1 | GROUP_CONCAT
  30. ------+--------------
  31.     1 | A,B,C
  32.     2 | C,D,E
  33. (2 rows)
RAW Paste Data
Top