Jump to content

[SOLVED] Average Ratings From DB


DrDankWD

Recommended Posts

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

 

  $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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.