View Single Post
  #3 (permalink)  
Old 12-01-2006, 04:19 AM
ben ben is offline
Administrator
 
Join Date: Mar 2007
Posts: 87
ben has disabled reputation
Default MySQL answer. Re: How to perform aggregation (sum) on a computed column?

This is specific to MySQL. This will give you a running sum. The last row will have the total sum of all the ages.

[sql]
SET @a := 0;
SELECT
(AGE * 10) AS XYZ,
@a := @a + (AGE*10)
FROM MY_TABLE
[/sql]
Reply With Quote