This topic is locked

Calculate SUM horizontal from multiple rows

4/18/2012 1:40:33 PM
PHPRunner Tips and Tricks
J
Jeroef author

I needed a table with a horizontal total field at the end instead of the vertical in totals page.

Strukture was:
ID,name,value1,value2,value3,total(of value 1-3)
Just go to query and type:



SELECT

ID,

namn,

`value1`,

`value2`,

`value3`,

SUM(`value1`+`value2`+`value3`) AS total

FROM trekamp

GROUP BY ID


Done.