I have been trying to figure this out for a while now and decided I’m not going to figure it out any time soon! Thanks for the help in advance. Love this place.
I have 2 tables
date:
date_id, user_id, cost, title, description
date_rating:
date_id, user_id, rating
I have multiple entries with the same date_id but different user_id‘s. In other words multiple ratings of the same date. The ratings are either 1 or -1. I want to add all the ratings together with the same date_id and then join that to my DATE table where date_id matches. So that I have a column called rating on the table DATE. This way I can sort by rating. Sounds easy but it has proven to be not so easy. I guess DBA is not my thing!
edit: MySQL client version: mysqlnd 5.0.8-dev – 20102224 – $Revision: 310735 $
Can’t you just use something like this? I’m no expert at MySQL, mind you (I’m more a SQL Server guy):
Just a correlated subquery to get the sum of ratings for each date specified by it’s
date_id?