Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2014-10-08 : 04:19:07
|
Hi All,I have one table called std and another is std_sub. Now I have to update subject_detail column of STD table like Math,EnglishPlease suggestStd_Sub is a below formatstd_id,subject1,Math1,English2,Science2,Math |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-10-08 : 08:29:58
|
[code]UPDATE sSET subject_details = stuff(ss.subjects, 1, 1, '')FROM std s CROSS APPLY ( SELECT ',' + subject FROM Std_Sub x WHERE x.std_id = s.id FOR XML PATH('') ) ss (subjects)[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|