1
id date
1  30/12/1987
1  20/01/1988
1  15/02/2000
2  02/02/2014
2  15/02/2014
3  10/10/1988

the result should be

1 30/12/1987,20/01/1988,15/02/2000
2 02/02/2014,15/02/2014
3 10/10/1988
Alex K.
  • 165,803
  • 30
  • 257
  • 277
prasad
  • 43
  • 4
  • 2
    possible duplicate of [Is there any function in oracle similar like group\_concat of mysql?](http://stackoverflow.com/questions/16771086/is-there-any-function-in-oracle-similar-like-group-concat-of-mysql) – Alex K. Jul 16 '15 at 11:36
  • Use `LIASTAGG` in 11g. – Lalit Kumar B Jul 16 '15 at 11:42

2 Answers2

2

Like this

SELECT 
    id,
    LISTAGG(date, ', ') WITHIN GROUP (ORDER BY id) "Dates"
FROM mytable
GROUP BY id
Samuel Neff
  • 70,536
  • 16
  • 132
  • 177
0

Easy way:

SELECT id, wm_concat(Date) as Dates
FROM   tablename
GROUP BY id;
Mukesh Kalgude
  • 4,742
  • 2
  • 16
  • 32
  • "Because WM_CONCAT is undocumented and unsupported by Oracle, it's recommended not to use it in production system" http://psoug.org/definition/WM_CONCAT.htm and even worse "Also, WM_CONCAT has been removed from 12c onward" https://oracle-base.com/articles/misc/string-aggregation-techniques#wm_concat – Samuel Neff Jul 16 '15 at 12:00