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 |
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-07-02 : 05:30:52
|
| Hi, i need an update query for below requirement.Table "Tbl_NCVoters" with following dataName CulturesatishranjithemanthTable "Tbl_LastName" with following dataName Culturesatish INDIhimesh RUSSsatish GERMyogesh ENGLhemanth RUSSNeed output as followsName Culturesatish INDI,GERMranjit nullhemanth RUSSI wrote an update query for this. but i need an update query to append the culture for the same name with comma. My query updates only one value. my query is belowUpdate t2 Set t2.Culture = t1.Culture From Tbl_NCVoters As t2INNER JOIN TBL_LastName As t1 on t2.Name = t1.NameG. Satish |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-07-02 : 05:42:01
|
| http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254MadhivananFailing to plan is Planning to fail |
 |
|
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-07-02 : 06:09:35
|
Can you give query related to my requirement. I am not able to understand that thing which u provided in the link. I am beginner to sqlserver.quote: Originally posted by madhivanan http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254MadhivananFailing to plan is Planning to fail
G. Satish |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-07-02 : 06:10:11
|
| Update t2 Set t2.Culture = t1.Culture From Tbl_NCVoters As t2INNER JOIN (select distinct Name, stuff((select ','+Culture from TBL_LastName where empid = t.empid for xml path('')),1,1,'')as culturefrom TBL_LastName t) As t1 on t2.Name = t1.Name |
 |
|
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-07-02 : 06:33:08
|
Thank you.. Its work perfectquote: Originally posted by bklr Update t2 Set t2.Culture = t1.Culture From Tbl_NCVoters As t2INNER JOIN (select distinct Name, stuff((select ','+Culture from TBL_LastName where empid = t.empid for xml path('')),1,1,'')as culturefrom TBL_LastName t) As t1 on t2.Name = t1.Name
G. Satish |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-07-02 : 07:56:30
|
quote: Originally posted by satish.gorijala Thank you.. Its work perfectquote: Originally posted by bklr Update t2 Set t2.Culture = t1.Culture From Tbl_NCVoters As t2INNER JOIN (select distinct Name, stuff((select ','+Culture from TBL_LastName where empid = t.empid for xml path('')),1,1,'')as culturefrom TBL_LastName t) As t1 on t2.Name = t1.Name
G. Satish
welcome |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-07-02 : 11:43:37
|
| also seehttp://www.projectdmx.com/tsql/rowconcatenate.aspx |
 |
|
|
|
|
|
|
|