All, 

In the following query, some of the values are averaged over several
rows, but some are not:

SELECT hostname, volname, qtreename, round(avg(used/allocated*100),0), 
        round(avg(used)), allocated, available
        FROM quota_entries
        WHERE date_sub(now(), interval 1 day) < timestamp
        GROUP BY qtreename,hostname

My questions: 
>From which of the several averaged rows do 'allocated' and 'available'
come in the results?
Can I control this?  I would like the row with maximum timestamp.

Thanks,
Bill

+-----------+------------------+------+-----+---------+----------------+
| Field     | Type             | Null | Key | Default | Extra          |
+-----------+------------------+------+-----+---------+----------------+
| id        | int(10) unsigned |      | PRI | NULL    | auto_increment |
| hostname  | varchar(32)      |      |     |         |                |
| volname   | varchar(32)      |      |     |         |                |
| qtreename | varchar(32)      |      |     |         |                |
| allocated | int(10) unsigned |      |     | 0       |                |
| used      | int(10) unsigned |      |     | 0       |                |
| available | int(10) unsigned |      |     | 0       |                |
| files     | int(10) unsigned | YES  |     | 0       |                |
| timestamp | datetime         | YES  | MUL | NULL    |                |
+-----------+------------------+------+-----+---------+----------------+

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to