List:General Discussion« Previous MessageNext Message »
From:Eamon Daly Date:May 12 2005 6:35pm
Subject:Re: Report(query)
View as plain text  
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" <sqlserverdb@stripped>
To: <hf1122x@stripped>; <mysql@stripped>
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 <use_reply_to@stripped> wrote:
> In article <20050511231512.39355.qmail@stripped>,
> 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.

Thread
Report(query)Seena Blace12 May
  • Re: Report(query)Harald Fuchs12 May
Re: Report(query)Seena Blace12 May
  • Re: Report(query)Eamon Daly12 May