Danish Habib

Danish Habib

  • NA
  • 694
  • 245.7k

Duplicate Record in join

Dec 30 2014 6:31 AM
I have two tables  QuestionTarget in which I have save the Target of question and Answer table in which i have Achieved value of that target .
Question Target Table 
QuestionID,Targetvalue
1                  55
2   67


Answer Table
AnswerID Question01 AchievedValue Question02 AchievedValue Question03 Achieved Value


Now I want to get the Target from the target table and AchievedValue from the  answer table 

My Query is this 
"SELECT A.AnswerId,CdfPErsonName, A.Year, A.Quarter, QT.QuestionTarget,A.Question01Total,Question01  FROM 
 Answers AS A
 LEFT  JOIN
 QuestionTarget  AS QT ON  QT.Question_ID=A.Question01  Where QT.Question_ID=1"


I also used LEFT OUTER JOIN INNER JOIN RIGHT JOIN NO ONE WORK THE PROBLEM IS THAT 
below is the record set which comes from the query 
Question01         QuestionTarget                  QuestionAchieved 
1                           53                                     12
2                           77                                      12

The question Target Columns are good they are saved as 53,77  but in answer table i have save answer of 12 against 53 then why it is pulling 12 against 77 also that is the question of the week





Answers (11)