<[EMAIL PROTECTED]> wrote:
> i thought about that, but i gave up on my first attempt on doing so,
because
> mysql complained about my query, it seems that it doesn't allow to use the
> max() function with a sum() function, an example of the query is:
>
> SELECT month,
>        daynr,
>        hour,
>        sum(numberofusers),
>        sum(numberofmails),
>        sum(numberofdownloads)
> FROM table
> GOURP BY month, daynr, hour
> WHERE where_clause;
>
> and mysql complaints when i do another column with max(sum(numberofusers))
:\

You just need to add a column max(numberofusers).  You've already grouped by
month, day and hour so:

sum(numberofusers) => total # of users for that month/day/hour/
max(numberofusers) => max # of users for any record for that month/day/hour

If you're really trying to get the total # of users for the single
month/day/hour with the most users then you need a second query.  If you can
put into sentences exactly what you're trying to do, we can probably help
you a little better.

> i think i'm doomed with the big loop thing :\

Nah, I think you can avoid it.  MySQL is your friend.  <grin>

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to