Hey Everyone,
I can you some assistance on this query.

I have three tables one is called ranking and the other is called routes and finally the users table. The users table is not really important.
The ranking table looks like this:


id      rating
1       5.0
2       5.1
3       5.2
4       5.3
5       5.3a
6       5.3b
and so on...

The routes table looks like this:

user_id route           rating
1               somename        5.2
1               "          "  5.3             
1               "          "  5.3a

Here's my query:
SELECT ranking.rating, AVG(id), users.username, users.user_id, routes.rating, routes.user_id FROM ranking, routes, users WHERE username='$username' AND users.user_id = routes.user_id AND ranking.rating = routes.rating GROUP BY username


What I am trying to do is find the average rating for this user. For example:

5.2 = 3
5.3 = 4
5.3a = 5
_______________
3 + 4 + 5 = 12 / 3 = 4

So 4 = 5.3
The average for this user would be 5.3. Any help would be most appreciated.
Craig



-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to