Good day to all. I have a table of users with fields:
id +-------------+ percent +-------------+ sum +-------------+ filter I need for each user with filter = 1 to increase the value in the sum field by a percentage (from the percent field) of the specified number. That is, if the specified number = 100 (may vary), then the user with percent = 15 needs to increase the value of the sum field by 15 (15 percent of 100).
All that I can now is to select all users with filter = 1, and then in a cycle using the programming language, read the percentage for each user and make a request in the database to set the new value of the sum field ... It seems to me that this is not The best solution and the task can be done using sql.
I would be grateful if someone tells you which way to look or give an example sql query for a given table.