Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
108
Reply
how to get distinct records sql server
Danish Habib
Aug 19 2015 7:40 AM
2k
Reply
If i have Two tables
First
QuestionID(primary key)
Target value
1
100
Second table
RecordID(primary key)
Achieved value
QuestionID (FORIGN KEY)
1
123
1
2
432
1
When i want to calculate the sum using Inner join i.e.
SELECT SUM(TargetValue) AS TARGET ,SUM(AchievedValue) AS ACHIEVED FROM First
INNER JOIN Second AS S ONS.QuestionID=First.QuestionID
Where 1=1
Then it gives me SUM OF TARGET VALUE 200 Instead of 100 Why???
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
108
)
Next Recommended Forum
SQL Server Job Agent Fails
Search based on Priority queue