Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

One to many query question

$
0
0

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?


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>