You can achieve this with the WITH ROLLUP option of GROUP BY. Although you
would probably have to perform a trick on the "date" column to have the NULL
value that WITH ROLLUP would return to return as "total" - i.e
IFNULL(date,'Total') as a quick (and dirty) example, as this doesn't work
too well on statements that have multiple GROUP BY columns ;)

You can read more about WITH ROLLUP here:

http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html

Mark Leith

> -----Original Message-----
> From: Tony Leake [mailto:[EMAIL PROTECTED] 
> Sent: 16 September 2005 13:19
> To: mysql@lists.mysql.com
> Subject: colum totals
> 
> Hi, 
> 
> I'm sure I read somewhere about a new function that would 
> give the totals of all columns, ie if i have 2 cols, 
> numberOfOrders valueOfOrders for a range of dates i can get 
> something like the following
> 
> 
> Date      numberOfOrders    valueOfOrders
> 01-09     4                 20.00
> 02-09     6                 100.00
> total     10                120.00
> 
> 
> could someone point me to this in the manual please as I 
> can't seem to find it. Or did i just imagine it anyway?
> 
> thanks
> 
> tony
> 
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/[EMAIL PROTECTED]
> 
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.11.0/103 - Release 
> Date: 15/09/2005
>  
> 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.0/103 - Release Date: 15/09/2005
 


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

Reply via email to