Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Sybase > Formatted Display

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-05-07, 07:42
J.Poornima J.Poornima is offline
Registered User
 
Join Date: Mar 2007
Posts: 25
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
Reply With Quote
  #2 (permalink)  
Old 12-06-07, 00:10
parangiri parangiri is offline
Registered User
 
Join Date: Feb 2007
Location: Chennai, TN
Posts: 59
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
Reply With Quote
  #3 (permalink)  
Old 12-06-07, 00:28
J.Poornima J.Poornima is offline
Registered User
 
Join Date: Mar 2007
Posts: 25
Thanks Parangiri for an immediate reply.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On