ok, i have a query that is like so.... select distinct(id), MIN(time), MAX(time), count(page), ip, (UNIX_TIMESTAMP(MAX(time)) - UNIX_TIMESTAMP(MIN(time))) from trainingHit group by id
and i really want to sort on the time difference, but i get an error that states invalid use of group function if i sort on (UNIX_TIMESTAMP(MAX(time)) - UNIX_TIMESTAMP(MIN(time))), and 0 values if i call this something like "val" and sort on that. But i can call it 'val' and that is returned correctly in the result set. Any ideas? Thanks in advance. Jd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php