I have come up with a bit of a problem which I cant seem to work out... I have a table that gets updated every minute with data. The table has 3 fields in it... id, date, number
what im trying to do with a single query is, select the last 60 records, and output the average of the number field when I do the following query, it takes the avg of every record. "select avg(number) from table order by date desc limit 60" Is this possible to do, or will I have to do a count loop within my program, then divide the count by 60 and do that output (which normally wouldnt be a problem, but im stuck in a perl script at the moment and I dont know enough about perl to do loops like this. Thanks Chris --------------------------------------------------------------------- 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