select sum(first) from example; 

should work.

Artem

-----Original Message-----
From: Kevin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 09, 2002 10:36 PM
To: [EMAIL PROTECTED]
Subject: Help with Sum(), newbie


OK. Maybe I'm expecting too much of myself, but I can't figure out what I am
doing wrong here:

mysql> select * from example;
+-------+--------+
| first | second |
+-------+--------+
| 1     | 2      |
| 2     | 3      |
+-------+--------+
2 rows in set (0.00 sec)

mysql> select first, second, SUM(first) from example group by first;
+-------+--------+------------+
| first | second | SUM(first) |
+-------+--------+------------+
| 1     | 2      |          1 |
| 2     | 3      |          2 |
+-------+--------+------------+
2 rows in set (0.00 sec)


If it is not obvious, I want the sum of "first," which, by my calculations,
should be 3. What am I doing wrong?


Thanks!

--kevin


---------------------------------------------------------------------
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

 
Attention:
Any views expressed in this message are those of the individual sender, except where 
the message states otherwise and the sender is authorized to state them to be the 
views of any such entity.

The information contained in this message and or attachments is intended only for the 
person or entity to which it is addressed and may contain confidential and/or 
privileged material. Any review, retransmission, dissemination or other use of, or 
taking of any action in reliance upon, this information by persons or entities other 
than the intended recipient is prohibited. If you received this in error, please 
contact the sender and delete the material from any system and destroy any copies.

---------------------------------------------------------------------
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