List:General Discussion« Previous MessageNext Message »
From:Mark R. Cervarich Date:August 3 2001 1:33am
Subject:Re: Help selecting something that occurred in past 5 minutes
View as plain text  
On 2 Aug 2001 mysql@stripped wrote:

> Your message cannot be posted because it appears to be either spam or
> simply off topic to our filter. To bypass the filter you must include
> one of the following words in your message:
> 
> database,sql,query,table
> 
> If you just reply to this message, and include the entire text of it in the
> reply, your reply will go through. However, you should
> first review the text of the message to make sure it has something to do
> with MySQL. You have written the following:
> 
> 
> Part I
> ======
> 
> I'm setting up a cron job and want to be able to get records that have
> been accessed in the past X number of minutes.
> 
> 
> I tried doing this:
> 
> SELECT postcard.uniq_id, (now() - accesstime) as smalldiff,
> recipients_last_name, accesstime 
> FROM postcard 
> HAVING (smalldiff <=500) and (smalldiff >= 0);
> 
> and it sorta works. (By tinkering I've found out that each minute is
> equal to 100 'ticks'(?) - so in the example above, 5min = 500.
> But it fails if the event occurred at 4:47pm and now it's 5:02pm.
> 
> Anyway, I'm sure there has to be a better way to do this...please help
> me! 
> 
> Also, what about in past 30minutes, past hour, past 6 hours, etc.
> 
> 
> Part II
> =======
> How can I get a count of this - meaning I only want outputted a number
> that corresponds to how many uniq.id's have been accessed in past X
> time period.
> 
> SELECT postcard.uniq_id, (now() - accesstime) as smalldiff,
> recipients_last_name, accesstime
> FROM postcard
> HAVING (smalldiff <=500) and (smalldiff >= 0);
> 
> 
> thanks a lot.
> mark
> 

Mark R. Cervarich
Shelfspace.com

Thread
Re: Help selecting something that occurred in past 5 minutesMark R. Cervarich3 Aug
  • Re: Help selecting something that occurred in past 5 minutesWerner Stuerenburg3 Aug