[dba-SQLServer] merging records

jwcolby jwcolby at colbyconsulting.com
Tue Nov 13 06:53:49 CST 2007


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 




More information about the dba-SQLServer mailing list