sql - How to select values as a list in PostgreSQL and Oracle Database? -


i have table values given below:

name  app_pgm_apply   status         p1             ap        p3             dn        p5             ap b        p2             pe b        p3             ap c        p1             ap d        p2             dn 

i want select user applied program list.

a   {p1,p3,p5} b   {p2,p3} c   {p1} d   {p2} 

can tell me how retrieve values list?

i saw in sql here . didn't how use postgresql

postgres has array_agg function:

select   name, array_agg(app_pgm_apply)     mytable group name  

oracle, on other hand, has listagg function:

select   name, listagg(app_pgm_apply, ',') within group (order app_pgm_apply)     mytable group name  

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -