I’m trying to make a table for reviews on blogs. In my table, I want to have these columns:
- id
- total number of ratings
- total values of ratings
That way I can just get the average rating with simple math.
Is there a way that I autoincrement 1 to the column that has the total number of ratings, and add the rating to the total number of total ratings without having to retrieve the information first?
For example, in PHP terms:
//instead of doing
$column=$currentValue;
$column=$column+5;
//do
$column+=5;
is this possible with a MySQL update function if the columns are INT?
try something like this