in reply to Re^4: Detecting 1 day ago
in thread Detecting 1 day ago

my $sth = $dbh->prepare( q{SELECT 1 FROM messages WHERE DATE_SUB(CURDA +TE(),INTERVAL 1 DAY) <= message_data LIMIT 1; } ); $sth->execute(); print "We got it" if $sth->rows();
See exists clause if mysql supports it, and if you can make it better fits your needs..


Evan Carroll
www.EvanCarroll.com

Replies are listed 'Best First'.
Re^6: Detecting 1 day ago
by Anonymous Monk on Feb 25, 2006 at 05:21 UTC
    Hi.

    Okay, I tried your code and it doesn't error out (which is great!) though I'm not sure what the problem is. It matches something every time. I then changed it down to 1 MINUTE instead of 1 DAY and it still matches every time when the last entry was some hours ago.