comments need to add in one row

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • santhu1
    New Member
    • Jul 2013
    • 14

    comments need to add in one row

    i have one table. table.

    application_id comments
    ------------------------------
    1234123412 pancard
    1234123412 driving license
    1234123412 birth certificate.

    0909090909 adharcard
    0909090909 ration card

    if i select 1234123412 i want the data like this,

    pancard,driving license, birth certificate.

    how to write the query using stuff .
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    Not sure which oracle version you are using but you can
    1) use hierarchical query (with connect by prior)
    2) use wm_concat function like that
    -define view
    Code:
    create view list_of_values as
    select application_id , to_char(wm_concat(comments)) from test  group by application_id
    -and query this view in the following way
    Code:
    select * from list_of_values  where application_id=1234123412
    Or just without the view you can query for specific application_id

    Code:
    select application_id , to_char(wm_concat(comments)) from test  where application_id=1234123412 group by application_id

    Comment

    • santhu1
      New Member
      • Jul 2013
      • 14

      #3
      thanks rski,

      the query is working fine

      Comment

      Working...