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 , a year 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.

Related Threads:

How can find sum of a column after group by result in mysql?
How to properly compare bigint column in mysql 5.7?
How to count/sum array on mongodb?
How to use sum() in an mysql expression?
How to use group by to sum values in mysql?
How to change column names in mysql?