Hi,
you can use mysql variables :

set @total:=0;
select name,price,quantity, price*quantity as
subtotal,@total:[EMAIL PROTECTED]
from fruits;

+--------+-------+----------+----------+-------------------------------+
| name   | price | quantity | subtotal | @total:[EMAIL PROTECTED] |
+--------+-------+----------+----------+-------------------------------+
| orange |     1 |        2 |        2 |                             2 |
| banana |     1 |        4 |        4 |                             6 |
+--------+-------+----------+----------+-------------------------------+

The total column will be incremented by subtotal in each row.

Mathias

Selon Philip George <[EMAIL PROTECTED]>:

> actually, i've decided this is sort of a moot point, since i can do
> this calculation in the client app.
>
> no sql required.
>
> thanks.
>
> - philip
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to