使用MySQL数据库和PHP我有一个名为appData的表和一些数字类型的列,我需要将它们的总和作为:
SELECT projectID,
lat,
long,
powerline,
penstock,
road,
area,
expense
FROM asppData
WHERE active = 1;
现在,你可以看到我有powerline, penstock, road, area, expense
数字类型(Km或货币),我需要将它们全部加在一起,请你告诉我如何做到这一点?
由于
答案 0 :(得分:1)
SELECT projectID,
lat,
long,
sum(powerline),
sum(penstock),
sum(road),
sum(area),
sum(expense)
FROM asppData
WHERE active = 1
group by projectID
lat,
long,