How do I sum the numbers in a field
I would like to add up the scores in a column in my table. I would like a little advice on the best way to do this. I have looked in the manual and see there is a function called array_sum(array arr). Would I be able to use this on the resulr set that comes back from a query which fetches the values from the column called 'scores'.
When I get the basics of this working, I would like to go one step further and sum only some of the values in the column e.g. sum only those values that correspond to the chemistry test and not the physics test. For reasons which I can't quite remember, I found it more convenient to store test results from more than one type of test in the same column. I have another column called 'testname' which identifies the test as chemistry or physics. I think you can put something like 'WHERE testname LIKE '%Chemistry%' as a clause to limit what the query returns - is that correct.