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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -