Jump to content

Bayesian Rating System Problem


tommyda

Recommended Posts

Here is my query.

 

<?php
$query = mysql_query("

SELECT
typeid,
(select count(typeid) from ratings) / (select count(distinct typeid) FROM ratings) AS avg_num_votes,
(select avg(rating) from ratings) AS avg_rating,
count(typeid) as this_num_votes,
avg(rating) as this_rating
FROM
ratings
GROUP BY typeid


")or die(mysql_error());

?>

 

Im getting this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select typeid, ((avg_num_votes * avg_rating) + (this_num_votes * this_rating) / ' at line 10

Link to comment
https://forums.phpfreaks.com/topic/185206-bayesian-rating-system-problem/
Share on other sites

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.