简体   繁体   中英

Mysql sum up the values of rows

SLNO UpazillaID CityArea VillageArea CharArea HillArea HaorArea TotalArea Year
6       1           11      44          11      11        11       11     2014
7       2           12      13          14      13        13       13     2013

I want to sum CityArea, VillageArea, CharArea, HillArea, HaorArea, TotalArea Where UpazillaID in 1,2.

Select (column1 + column2 + column3....) as totalcolumn. This will give you the sum per row.

SELECT (SUM(CityArea)+SUM(VillageArea)+SUM(CharArea)+SUM(CharArea)+SUM(CharArea)+SUM(TotalArea)) 
AS Total
FROM your_table
WHERE UpazillaID = 1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM