From the manual:

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

"If you use a group function in a statement containing no
GROUP BY clause, it is equivalent to grouping on all rows."

Just run the same query without the GROUP BY to get the
total:

SELECT
DATE_FORMAT(date, '%Y-%m-%d') AS date,
SUM(process),
SUM(pending),
SUM(wip)
FROM tab
GROUP BY date;

SELECT
'Summary',
SUM(process),
SUM(pending),
SUM(wip)
FROM tab;

____________________________________________________________
Eamon Daly



----- Original Message ----- From: "Seena Blace" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <mysql@lists.mysql.com>
Sent: Thursday, May 12, 2005 12:54 PM
Subject: Re: Report(query)



ROLLUP is not working with current version.IS any way i can do?
I have 1 column names time with data type datetime.I want to get report like
yyyy-mm-dd format.
Can I get by using date_format(nameofcolumn,'%Y-%m-%d')?




Harald Fuchs <[EMAIL PROTECTED]> wrote:
In article <[EMAIL PROTECTED]>,
Seena Blace writes:

Hi,
I want report like this

date process pending wip

5/10/05 10 30 40
5/11/05 09 28 60
------------------------------------------------------------
Summary 19 58 100



select date,sum(process),sum(pending),sum(wip) from tab
group by date;
What command I used to show heading and what command to show sub total and total ?

The last row can be calculated by the ROLLUP modifier of GROUP (requires MySQL 4.1.1 or later). Nicely formatting the output with headings etc is not the business of a database engine and should be done by your application.


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



Reply via email to