|
Posted by Erland Sommarskog on 04/01/07 18:40
Matt F (franzey@gmail.com) writes:
> The AnswerID corresponds to the Department. One row for each. To make
> is simple, it essentially has only the AnswerID and the AnswerText.
You previously had this sample data:
VoterID AnswerText AnswerID
5 Comments here 2058
5 <NULL> 2057
5 <NULL> 2059
Then you said:
AnswerID is found in the Answer table which corresponds (in this case)
to 2057="Technology" and 2059="Satisfied"
And you want this output:
VoterID Department Rating
---------- ----------------- ------------
5 Technology Satisfied
Somehow we need to magicaly know that answer id 2057 is a department and
that 2059 is a rating. But how do we know that?
There is a general recommedation for this type of questions, and that
is you post:
o CREATE TABLE statements for your table(s).
o INSERT statements with sample data.
o The desired output given the sample.
That makes it possible to copy and paste to develop a tested solution.
Without that, what you get is more or less guessworks. Since you have
already refuted one guess, I don't really feel like playing the game.
I'm sorry, if I'm long-winded, but the bottom line is that to get accurate
help in these forums you must be able to explain your problem so that
others can understand it.
--
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
Navigation:
[Reply to this message]
|