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 |
|
allan8964
Posting Yak Master
249 Posts |
Posted - 2012-11-26 : 17:34:09
|
| Hi there,On Nov. 20 I submitted a question, see http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=180820 and sodeep gives perfect anwer. But now the situation is little bit different:when the same combinationed recored found, here is the first part of the codes:Select CodeId,TypeId,ModelId,Count(*),Col1, Col2, ........into #tempfrom TableGroup by CodeId,TypeId,ModelIdHaving Count(*) > 1Now I need merge col1 from duplicated records together. For example, Id | Col1 | Col2 ...11 | ABC | ...13 | CBX | ...after the merge, the save back record for Col1 should look like ABC,CBX and Col2 and the rest columns should remain intact.How can I do this? Thanks in advance. |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2012-11-27 : 06:36:19
|
| If you are saying you want to turn column 1 into a comma separated value, you should rethink your schema. http://en.wikipedia.org/wiki/First_normal_formHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
allan8964
Posting Yak Master
249 Posts |
Posted - 2012-11-27 : 11:44:39
|
[quote]Originally posted by DonAtWork If you are saying you want to turn column 1 into a comma separated value, you should rethink your schema. http://en.wikipedia.org/wiki/First_normal_formThanks for the reply but I don't think you understand my question. |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2012-11-27 : 14:15:05
|
| Merge Col1 based on Id????Please give examples and expected output. |
 |
|
|
|
|
|
|
|