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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-02-03 : 08:18:49
|
Michael writes "Hello,I am trying to combine data into a single cell in a data table and delete duplicates. This sounds confusing so I will give you an example of what I am trying to accomplish. I am working with acronyms.Sample table 1:AB Al BenAB Atlanta BombersAB Aztec BrazilI need this table with 2 columns and 3 rows to look like this when I am doneAB Al Ben, Atlanta Bombers, Aztec BrazilSo it lists out all possible meanings of AB next to AB in the same row and deletes the other rows. There will also be rows that have only one single meaning like thisAB Atlanta BombersAZ Arizona ZebrasBC Baltimore Coolersthose are all fine, just combine the ones which have more than one meaning. Thank you so much in advance for the help. I have gotten this to work in excel, can not get it to work in access. Thanks again." |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-02-03 : 13:08:07
|
quote: can not get it to work in access. Thanks again
I think you need post this in the MS Access forumBe One with the OptimizerTG |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-02-04 : 06:45:32
|
Somewhat tough in AccessAny way try thisselect * into temptable from (Select * from (Select Distinct a,b ,(select count(*) from Test T1 where T1.A=T2.A and T1.b<=T2.B) as Sno from test T2 ) t)thenSelect Distinct A+' '+One+' '+ two+' ' +iif(isnull(three),'',three) as Result from (select A, (Select B from temptable T1 where t1.A=T2.A and T1.Sno=1) as one,(Select B from temptable T1 where t1.A=T2.A and T1.Sno=2) as two ,(Select B from temptable T1 where t1.A=T2.A and T1.Sno=3) as three from temptable t2) tMadhivanan |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-02-04 : 08:46:11
|
so, you want to take a normalized database and unnormalized it, stuffing multiple values into 1 column? Or is this an output/presentation issue -- you want to take you existing data and generate a report or a query that formats the data that way?- Jeff |
 |
|
|
|
|
|
|