Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jasmen
Starting Member
11 Posts |
Posted - 2014-04-19 : 09:55:37
|
Hi i am making multiple criteria rating for doctors from Knowledge,Helpfulness,Punctuality,Staff i made table called DoctorsRatingsDoctorid int TotalRating int StaffRating int PunctualRating int KnowledgeRating int HelpfulnessRating int i have many users can rate one doctor so i have to sum(StaffRating,PunctualRating,PunctualRating,KnowledgeRating,HelpfulnessRating) and put the sum result in TotalRating and get avg of TotalRating or what ???last thing every criteria it rated from 1 to 5 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-04-19 : 10:33:08
|
[code]Update DRSet TotalRating = StaffRating + PunctualRating + KnowledgeRating + HelpfulnessRating, AverageRating = (StaffRating + PunctualRating + KnowledgeRating + HelpfulnessRating) / 4.0From DoctorsRatings DR[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
jasmen
Starting Member
11 Posts |
Posted - 2014-04-19 : 11:03:43
|
quote: Originally posted by khtan
Update DRSet TotalRating = StaffRating + PunctualRating + KnowledgeRating + HelpfulnessRating, AverageRating = (StaffRating + PunctualRating + KnowledgeRating + HelpfulnessRating) / 4.0From DoctorsRatings DR KH[spoiler]Time is always against us[/spoiler]
thanks but if Rate StaffRating PunctualRating KnowledgeRating HelpfulnessRating totalrate user1 2 5 1 3 2.75user2 2 2 2 2 4i will select AVG(TotalRating)??? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-04-19 : 22:27:29
|
it depends on what you want.You want average rating for all users then it is AVG(TotalRating)if you want average rating for a user then it is sum of all rating for a user and divide by no of ratings KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|
|
|