Below query was asked by velocetti on MSDN SQL Forum, please refer below link for original post.
Scenario:
I have the following table structure
Subject
SubjectID int
SubjectDetails (varchar(100)
SubjectType
SubjectTypeId (PK)
SubjectID (FK)
SubjectType (varchar(30)
I want to have this type of result set which is essential one Subject row, with SubjectType(s) as another column comma delimited.
So my result set would look like this
SubjectID SubjectDetails SubjectTypes
1 test details SubjectType1, SubjectType2, SubjectType3
How would I accomplish this in TSQL?
No comments:
Post a Comment