I have two tables. Table #1 ‘color’ has columns [red], [blue], [green]; where each column is an int type representing the number of times the color was selected, they are counters so to speak.
Table #2 ‘selected_colors’ has columns [person] and [color], where person is not unique. For each selected color by a person there will be one row containing [person] and [color].
My problem is I have since reset the counters in Table #1. I still have the info in Table #2, however. I need to set the color counters based on the query on the Table #2.
Short question: How to use UPDATE from SELECT result?
Without seeing your table definitions or example data and considering you only have 3 colours and this is a once-off exercise try this:
and repeat for blue and green.