Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2007
    Posts
    25

    Unanswered: Formatted Display

    Hi Experts,

    Could you help me in framing a query for the following requirement.

    I have a table called test with the following data

    id Name
    1 A
    1 B
    1 C
    2 A
    2 B

    My output should look like this

    1 A,B,C
    2 A,B

    Thanks in advance.
    Regards,
    Poornima

  2. #2
    Join Date
    Feb 2007
    Location
    Chennai, TN
    Posts
    68
    In sybase ASA, there is an aggregate function called list, which can give the output as required by u. The select query will be like below

    select id, list(Name) from test group by id

    Below link on List() function is as below
    http://searchoracle.techtarget.com/a...301455,00.html

    List function produces a comma-separated list of all the non-null values in a column for each group in a GROUP BY query

    But if u r a sybase ASE user then there is no such aggregate function in sybase 12.5.x as per my knowledge and we cant create functions in sybase ASE 12.5.x also. so the better way might be to use a stored procedure

  3. #3
    Join Date
    Mar 2007
    Posts
    25
    Thanks Parangiri for an immediate reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •