title: MySQL, apply a function on one column and then update another column for each row
body: <p>Two of a table's columns are named csv and s. csv contains comma separated 1 digit numbers as a string, no duplication, like '1,5,3,2', there is no duplication like '1,5,1'. Want to count how many 1s and 3s there are in 'csv' and put the count into column 's'. It's like to apply a function to each 'csv' and put the result into 's' for each row. I know how to count, but had never seen how to apply a function to one column and put result into another column. This is done in stored procedure, do I have to go through it row by row.</p>