I have no idea How can it be done or is it possible In Query.? Can be done in PHP.? If So any Idea or examples.
Here I have 2 tables.
Review
id pid published
-- --- ---------
1 12 0
2 14 1
3 16 1
Rating
id rid ratings sum
-- --- --------------------- -------
1 2 4,5,3,3,3.5,5,5,5,4,5 42.5000
2 4 4,5,3,3,3.5,5,5,5,4,5 42.5000
3 1 5,5,4,4,5,5,4,4,4,4 44.0000
What I would Like to Do is
- Update the Rating table based on Review.id = Rating.rid.
- Update ratings field where ever Is find 3 or 2 or 1 update to 4 like example this 4, 5, 3, 3, 3.5, 5, 5, 5, 4, 5 should be 4, 5, 4, 4 ,4, 5, 5, 5, 4, 5
- Based On update ratings field SUM field should Automatic Update the Sum of the rating values. Example this 42.5000 should be 45.0000
I tried to explain my question if it is not clear please ask me to Modify or give you more detail.
My tables are exact same as example. ratings field has text data type. There Is no Another tables for ratings.
Any helps will be highly appreciate.
Thanks You.