What's wrong with SUM?

select sum(count)
from table;

Does it get any simpler than that?

regards,
thalis

On Wed, 14 Mar 2001, Maxim Maletsky wrote:

> 
> Hello everyone,
> 
> I have a quick question:
> 
> the following table keeps a track of logged in users. 
> 
> 
> CREATE TABLE auth_lost_in_space (
>    sid varchar(32) NOT NULL,
>    count smallint(5) unsigned zerofill DEFAULT '00001' NOT NULL,
>    date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
>    PRIMARY KEY (sid)
> );
> 
> 
> Count is the amount of time the sid logged in.
> 
> What I need is to have a SELECT statement which selects every row and
> combines the values of count together:
> 
> count 00001
> count 00005
> count 00001
> count 00003
> count 00001
> 
> and with one select I want to get 11 (or 00011 which is the summary of count
> in all rows)


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to