sql - Concatenate ​​date values in Postgres -


i have table contains duplicate values in columns c1, c2, c3, c4, c5.
want list dates in row contain values generated group function.

datum          c1    c2    c3    c4    c5    number 2001-04-22     1     2     3     4     5     2 1999-08-24     2     3     4     5     6     2 2005-11-08     2     4     5     6     7     2 1998-03-20     1     2     3     4     5     2 2009-07-02     2     3     4     5     6     2 1996-05-21     2     4     5     6     7     2 

result should this:

datum                      c1    c2    c3    c4    c5    number 1998-03-20 , 2001-04-22    1     2     3     4     5     2 1999-08-24 , 2009-07-02    2     3     4     5     6     2 1996-05-21 , 2005-11 08    2     4     5     6     7     2 

in source table can duplicate values ​​in columns, solution?

select string_agg(to_char(datum, 'yyyy-mm-dd'), ','),        c1,         c2,        c3,         c4,         c5,         number some_table group c1, c2,c3, c4, c5, number 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -