Re: [PHP-DB] Simple Question, hopefully simple answer
- Original Message - From: Luke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 08, 2001 10:52 AM Subject: [PHP-DB] Simple Question, hopefully simple answer In one of my mySql tables I have a colum that contains many fields of numbers. for example | id | Name | Age | Sex | |1 | Jim | 17 | m| |2 | Dave | 31 | f | |3 | Fred | 25 | m| Ok and I want to get the total value of all the ages out of the table. how can I get this? mysql_query(select sum(age) as total from table); maybey you need after the from table the follow rule: distinc by id. it is not tested. success Jeroen Hope someone can help. Luke -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Simple Question, hopefully simple answer
Luke, In one of my mySql tables I have a colum that contains many fields of numbers. for example | id | Name | Age | Sex | |1 | Jim | 17 | m| |2 | Dave | 31 | f | |3 | Fred | 25 | m| Ok and I want to get the total value of all the ages out of the table. how can I get this? RTFM (MySQL) for COUNT() and SUM() (and many other useful functions). Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Simple Question, hopefully simple answer
RTFM (MySQL) for COUNT() and SUM() (and many other useful functions). My MySQL client is giving me a syntax error when I enter that command. :-) =that? Please post the SQL/PHP causing the problem - the list's crystal ball filter is not working. =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php