-4

I need some help to create an sql query on Oracle.

I am looking to do the exact same thing as shown in this thread

Join one row to multiple rows in another table

This thread is done in MySql, whereas I need to do it with Oracle.

Thanks for the help

Community
  • 1
  • 1
carlg
  • 1,802
  • 4
  • 25
  • 39
  • and you wrote group_concat yourself, but it doesn't work correctly? – Randy Apr 12 '12 at 13:52
  • 2
    And what have you tried? What's the problem? – Anonymous Apr 12 '12 at 13:52
  • 1
    possible duplicate of [How can I combine multiple rows into a comma-delimited list in Oracle?](http://stackoverflow.com/questions/468990/how-can-i-combine-multiple-rows-into-a-comma-delimited-list-in-oracle) – APC Apr 12 '12 at 17:09

2 Answers2

2

This is a poor way to ask question but I think this is what you need.

After 11gr2, you can use LISTAGG, documented here.

For lower versions, use wm_concat but it's not documented. There are many examples in web for both cases, since you didn't provide enough information I can't give you an example. Just see for yourself and match your need.

Erkan Haspulat
  • 12,032
  • 6
  • 39
  • 45
1
SELECT x.name,
      wmsys.wm_concat (y.property)
 FROM PEOPLE x
LEFT JOIN PROPERTIES y ON y.name = x.name
WHERE x.age > 26
GROUP BY x.name
shkelzen
  • 11
  • 1