Subject: sql - concating columns for rows with same ID
Posted By: yuvalk Post Date: 9/7/2006 9:19:12 AM
Hi All,

I have a table as follow :

ID  Value
1   aaa
1   bbb
2   ccc
3   ddd

I want to have the following as a result

1 aaa + bbb
2 ccc
3 ddd

that is to concat the columns which their rows have the same ID.

any idea?

Thank you,
Yuval
Reply By: David_the_DBA Reply Date: 9/8/2006 4:45:54 PM
Is there a limit to how many rows might have the same id value?

David Lundell
Principal Consultant and Trainer
www.mutuallybeneficial.com
Reply By: yuvalk Reply Date: 9/13/2006 1:35:09 PM
Hi ,

No there is no limit.
But it will be something like2 or 3 times.

Yuval

Yuval
Reply By: Mikebrass Reply Date: 9/20/2006 4:51:36 PM
you can use inline views, at least Oracle's sql has this functionality

Reply By: yuvalk Reply Date: 9/26/2006 10:16:43 AM
Hi Mike,

Its sql Server 2000/2005

Yuval

Yuval
Reply By: Mikebrass Reply Date: 9/26/2006 10:46:39 AM
it does not really matter. It's sql language.

Reply By: Mikebrass Reply Date: 9/26/2006 10:47:18 AM
it does not really matter in this case SQL Server or Oracle or DB2. It's sql language.


Go to topic 31411

Return to index page 164
Return to index page 163
Return to index page 162
Return to index page 161
Return to index page 160
Return to index page 159
Return to index page 158
Return to index page 157
Return to index page 156
Return to index page 155