TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Danish Habib
NA
694
245.9k
how to get distinct records sql server
Aug 19 2015 7:40 AM
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???
Reply
Answers (
108
)
SQL Server Job Agent Fails
Search based on Priority queue