DrDankWD Posted July 4, 2007 Share Posted July 4, 2007 Hello, I need a bit of help making an average from multiple ratings. There are two DB tables, one is "venues" the other is "ratings" the "venues_id" field in the "ratings" table matches up with the "venues_id" field in the "venues" table. The "ratings" table had three different values for different aspects of the rating: "food", "service", "ambience". Each one of the three rating parts is a number 1-5. What I need to do is get an average rating for each venue. If this doesn't make any sense please let me know, I will try harder to explain it. Thanks In Advance, DrDankWD Link to comment https://forums.phpfreaks.com/topic/58465-solved-average-ratings-from-db/ Share on other sites More sharing options...
teng84 Posted July 4, 2007 Share Posted July 4, 2007 $myString = "SELECT food,service,ambience FROM venues y INNER JOIN ratings x ON y.venues_id=x.ratings"; that for the joining i dont understand much of the question so i gues i do it this way heres to get the average AVG(values here) then maybe you will need the group by and/or distinct Link to comment https://forums.phpfreaks.com/topic/58465-solved-average-ratings-from-db/#findComment-289935 Share on other sites More sharing options...
DrDankWD Posted July 4, 2007 Author Share Posted July 4, 2007 I didn't even think of AVG(), that should work nicely, I will post here if I have any more problems with this, otherwise will close the post. Thanks!! -DrDankWD Link to comment https://forums.phpfreaks.com/topic/58465-solved-average-ratings-from-db/#findComment-289937 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.