Re: a (my)sql sort

From: Date: Thu, 06 Jun 2002 17:25:55 +0000
Subject: Re: a (my)sql sort
Groups: php.db 
Request: Send a blank email to php-db+get-19646@lists.php.net to get a copy of this message
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

« previous php.db (#19646) next »