in reply to MySQL, UNIX_TIMESTAMP() and Perl's time()

> Can anybody shed any light on this, maybe I can use MySQL's
> time functions in my SELECT statement?

Why not?

SELECT * FROM YOURTABLE WHERE YOURCOL + 48 * 3600 > UNIX_TIMESTAMP();
The code is untested.

Replies are listed 'Best First'.
Re: Re: MySQL, UNIX_TIMESTAMP() and Perl's time()
by Rhandom (Curate) on May 16, 2003 at 15:07 UTC
    That will work - but it will have to do a calculation for every value of YOURCOL. You may want to change it around to:
    SELECT * FROM YOURTABLE WHERE YOURCOL < UNIX_TIMESTAMP() - 24 * 3600;

    That way the db only does one calculation and can then compare it to the values of YOURCOL and even still use an index if there is one.

    my @a=qw(random brilliant braindead); print $a[rand(@a)];