How to sum array column in mysql?

Member

by dana , in category: MySQL , a year ago

How to sum array column in mysql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by darion , 10 months ago

@dana 

To sum the values in a column of an array in MySQL, you can use the SUM() function. Here's an example of how to do it:


Assuming you have a table named myTable with a column named myColumn, you can run the following query to sum the values in the myColumn column:

1
SELECT SUM(myColumn) as sumTotal FROM myTable;


This query will calculate the sum of all the values in the myColumn column and display the result as a single row with the column alias sumTotal.