What would be the best way to determine the difference (hh:mm:ss) between
two datetimes?
I do something like
(unix_timestamp(issuestop)-unix_timestamp(issuestart))/3600 to get the
hours -- but would much rather get something like hh:mm:ss
any ideas?
thanks,
graeme
----- Original Message -----
From: Richard M. Neswold <rneswold@stripped>
To: Chai-Hup Chen <hup@stripped>
Cc: <mysql@stripped>
Sent: Thursday, June 17, 1999 1:04 PM
Subject: Re: Any way to be faster?
> On Thu, 17 Jun 1999, Chai-Hup Chen wrote:
>
> > Any way to let unix_timestamp()-unix_timestamp(thetime) be faster?
> > I have already index on thetime (timestamp(14)), but the response time
> > is still too slow. Any help will be appreciated. Thanks.
> >
> > select count(*) from Books;
> > +----------+
> > | count(*) |
> > +----------+
> > | 150749 |
> > +----------+
> > 1 row in set (0.00 sec)
> >
> > select count(*) from Books where
unix_timestamp()-unix_timestamp(thetime) > 1;
> > +----------+
> > | count(*) |
> > +----------+
> > | 150774 |
> > +----------+
> > 1 row in set (10.90 sec)
>
> Try to get the field-dependant portion out of the calculation. In other
> words, compare the field with a constant. What does this give you?
>
> select count(*) from Books
> where unix_timestamp() - 1 > unix_timestamp(thetime);
>
> Rich
>
> ========================================================================
> Richard Neswold | rneswold@stripped
> Home Page 'http://www.mcs.net/~rneswold/' |
> PGP Key 'finger rneswold@stripped' |
>
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread5351@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail mysql-unsubscribe@stripped instead.
>
>