List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:June 15 2001 8:35pm
Subject:Re: SUM() function in select statement
View as plain text  
That should work.
What OS, kernel, version, compiler are you using?

kitty79 wrote:

> hi folks,
> i have the following table (table_name=comment)
> +---------+----------------------+------+-----+------------+----------------
> +
> | Field   | Type                 | Null | Key | Default    | Extra
> |
> +---------+----------------------+------+-----+------------+----------------
> +
> | id      | smallint(5) unsigned |      | PRI | 0          | auto_increment
> |
> | taste   | int(6)               |      |     | 0          |
> |
> | ph      | int(6)               |      |     | 0          |
> |
> | enabled | char(1)              | YES  |     | N          |
> |
> +---------+----------------------+------+-----+------------+----------------
> +
> 
> with the following content:
> +----+-------+----+---------+
> | id | taste | ph | enabled |
> +----+-------+----+---------+
> |  1 |     5 |  8 |         |
> |  2 |     2 |  7 |         |
> |  3 |     8 |  3 |         |
> +----+-------+----+---------+
> 
> and want to do a select statement like
> 	select SUM(taste) FROM comment;
> to get the summation of taste (here 15)
> 
> mysql> select SUM(taste) FROM comment;
> +------------+
> | SUM(taste) |
> +------------+
> |          0 |
> +------------+
> and got this result:-( whats wrong? thank you:-)
> 
> Tobias
> 
> 
> ---------------------------------------------------------------------
> 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 <mysql-thread76756@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-- 
Gerald L. Clark
gerald_clark@stripped

Thread
SUM() function in select statementkitty7915 Jun
  • Re: SUM() function in select statementGerald Clark15 Jun