[dba-SQLServer] merging records

jwcolby jwcolby at colbyconsulting.com
Tue Nov 13 07:31:24 CST 2007


>I may have filled in one poll as Arthur Fuller and another as Arthur B.
Fuller.

True.  Unfortunately there is not much I can do about that.  I do have the
full address (verified correct by the post office) to work with however.  I
may end up doing something about that scenario but in the meantime Arthur
and Arthur B. are two people.  

It could be argued that if you are inconsistent in how you write your name
that perhaps you really are two people anyway.  Or even three or four (or a
dozen in your case).  There is a psychological term for folks like you!!!

;-)


John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur
Fuller
Sent: Tuesday, November 13, 2007 8:18 AM
To: dba-sqlserver at databaseadvisors.com
Subject: Re: [dba-SQLServer] merging records

Given an unknown number of duplicate person records (for different polls), I
can't think offhand of a set-based way to do it (although perhaps a creative
use of COALESCE() might work). I think that the recordset approach may be
your best option. Even that approach might have problems, however. I may
have filled in one poll as Arthur Fuller and another as Arthur B. Fuller.

A.

On 11/13/07, jwcolby <jwcolby at colbyconsulting.com> wrote:
>
> I have tables of information about people.  The tables represent polls 
> that people have taken, so if a person takes a poll about brands of 
> cigarettes smoked, the table would have a record about that person for 
> that poll.  If that same person took a poll about software used, the 
> table would have a NEW record with information about the same person, 
> but about the software that person used.  And so forth and so on.  Now 
> I need to "roll up" all of the information about a person into a 
> single record so that one record contains all of the information about 
> that person contained in all of the records about that person in the 
> table.
>
> Is this possible directly in SQL?  Do I need to write code to iterate 
> through the table finding each person and all the records for that 
> person, and then consolidating the information from the second and 
> subsequent records into the first record found?
>
> John W. Colby
> Colby Consulting
> www.ColbyConsulting.com
>
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list