Wednesday, March 28, 2012

help on select query

Hi, All
There are two tables A and B. the structure like these.
Table A
ID , Name, etc...
Table B
ID,Title,ForigenKeyToA, etc...
And one person may have multi-titles, if I join A and B, I will get
A.ID, A.Name,B.title
1, John, 'AAA'
1, John,'BBB',
2, Bill, 'AAA',
2, Bill, 'CCC'
3, Joe,'AAA'
As you can see, one person has multi-title will show multi-times, I want to
use T-SQL (not cursor) to show the mergered the multi-Title in a single row,
like these,
A.ID, A.Name,B.title
1, John,'AAA'+'BBB'
2, Bill,'AAA'+'CCC'
3, Joe,'AAA"
how acn I do this?
Any help will be appreciated, thanks
BrianHi, Brian
See: http://www.aspfaq.com/show.asp?id=2529
Razvansql

No comments:

Post a Comment