Dan, :) $sth = $dbh ->prepare( qq{ SELECT SUM(time_track_minutes) FROM table WHERE status = 'COMPLETE' } ) || die $dbh->errstr; ; $sth->execute; Regards, Daniel Falkenberg List, I have a problem here that I am having a little bit of trouble trying to resolve. Firstly I have a Perl script that connects to a PostgreSQL database using the DBI module. I want to be able to SELECT a column from the database and return the total result. For example if I do the following... $sth = $dbh ->prepare( qq{ SELECT minutes FROM table WHERE status = 'COMPLETE' } ) || die $dbh->errstr; ; $sth->execute; The minutes attribute is of type integer. I want to be able to calculate the total for the attribue minutes. So far the result for the SQL query above is... minutes -------- 30 45 5 5 15 25 15 5 25 25 (10 rows) How would I with Perl now count the column above and return a result? Any ideas would help imensly. kind regards, Daniel Falkenberg ============================== VINTEK CONSULTING PTY LTD (ACN 088 825 209) Email: [EMAIL PROTECTED] WWW: http://www.vintek.net Tel: (08) 8523 5035 Fax: (08) 8523 2104 Snail: P.O. Box 312 Gawler SA 5118 ============================== -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]