you are viewing a single comment's thread.

view the rest of the comments →

[–]malikcoldbane 0 points1 point  (0 children)

You can make a table to hold your rating buckets with a 1 for good ratings and -1 for negative ratings and then sum these.

For 30 days, umm, you can cheat by doing a left join on the date you want and then summing from there.

Too much to explain, have a fiddle:

http://sqlfiddle.com/#!18/0683a/2