0

if there is a table.

id  |total |  setcolumn
1   |  5   |  2,3,4
2   |  1   |  1,3
3   |  3   |  2,1,4

i need to update total column to equal sum of setcolumn like this

id  | total|  setcolumn
1   |  9   |  2,3,4
2   |  4   |  1,3
3   |  7   |  2,1,4
Akram Elhaddad
  • 194
  • 3
  • 7

1 Answers1

0

You can split the meta column values by "," this way it will create differently each row and then you can use group by to add them.

Seems similar to your question here:

SQL split values to multiple rows

trillion
  • 1,207
  • 1
  • 5
  • 15