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

One to many record query question

$
0
0

I have the following table structure below. I want to query the subject table and subject types table and concatenate the subjectTypes into one column (comma separated).

So the result should be

Column 1      Column2      Column3
Doe              John             (SubjectType1, SubjectType2, etc…)

 

Subject Table
SubjectID (int) PK
Firstname(varchar(50))
Lastname (varchar(50))


SubjectTypes Table
SubjectTypeID (int) PK
SubjectID (int) FK
SubjectType (varchar(50))

 

 How would I do 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>