|  | Posted by Erland Sommarskog on 03/30/07 21:50 
Matt F (franzey@gmail.com) writes:> You are correct in that the information is coming from different
 > tables. The people "upstairs" have been using a web-based survey
 > system that dumps the results into SQL. The problem, is that I am
 > trying to run reports on some of the information and the way the data
 > is laid out is making it difficult. For example, the survey in
 > question is a short 4 question survey with 2 radio selection groups
 > and then there are 2 text field entries. I am only concerned with the
 > 2 radio selection questions. Question 1 has 4 radio options and
 > question 2 has 5. The problem here is that when the system submits the
 > data to the DB, it creates a record for EACH answer on the survey. For
 > example, the VoterAnswers table will have the VoterID, AnswerText,
 > etc... for each question on the survey with the VoterID remaining the
 > same. This is what is looks like:
 >
 > VoterID     AnswerText           AnswerID
 > 5              Comments here         2058
 > 5              <NULL>                    2057
 > 5              <NULL>                    2059
 >
 >
 > AnswerID is found in the Answer table which corresponds (in this case)
 > to 2057="Technology" and 2059="Satisfied"
 >
 >
 > What I need is one recordset with the following format.
 >
 > VoterID    Department     Rating
 > ----------     -----------------    ------------
 >      5        Technology     Satisfied
 >
 >
 > Does this clear anything up?
 
 But how to which know which row is the department and which is the
 rating?
 
 
 --
 Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
 
 Books Online for SQL Server 2005 at
 http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
 Books Online for SQL Server 2000 at
 http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
 [Back to original message] |