Greetings,

Does anybody have any ideas or existing code how to make a ratings systems i.e.

Users select 1-5 on a drop down box and it calculates the average from all the previous values, the system uses an MS Access database to store the data (Rating feild exists in the db schema)

Thanks
Rob

Recommended Answers

All 3 Replies

yup. Tiny bit of mathematics should do.
Addition, division, maybe multiplication, and you're done.

I'm think this maybe a problem solved purely by SQL.

I'm working on the following :-

UPDATE FAQ
SET Rating = (SELECT AVG(Rating + 7) FROM FAQ WHERE Category = "Email" AND 
Question = "New" GROUP BY FAQ.Category, FAQ.Question)
WHERE Category ="Email"
AND QUESTION ="Question";

I like your reply 'Think for yourself' nice.

that wouldn't work.
The average can only be determined if you know the previous average as well as the number of records over which it was determined.

new_average = ((old average * count) + new_rating) / (count + 1);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.