Shawn, That's a very reasonable answer. Thanks for pointing me to the examples. This one addresses the second question: http://dev.mysql.com/doc/refman/4.1/en/example-maximum-column-group-row. html . There is no example answering both questions in one query.
Regards, Bill ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, October 28, 2005 11:14 AM I do not think you are posing a single-statment question to the database (I count subqueries as second statements). You would like to find the averages of (used/allocated) and (used) for all (qtreename,hostname) pairs. That's one question. The second question is to return the row with the greatest timestamp for each (qtreename,hostname) pair along with the averages calculated in the first question. To find the answer your first question is a simple GROUP BY query. To find the answer to your second takes a max-of-group-pattern query: http://dev.mysql.com/doc/refman/4.1/en/examples.html If it were me, I would use a temporary table for each stage and combine them to form the final report. If you need more help, just come back. Shawn Green Database Administrator Unimin Corporation - Spruce Pine -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]