Mark R. Cervarich schrieb am Freitag, 3. August 2001, 03:33:44:
> On 2 Aug 2001 [EMAIL PROTECTED] 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.
??? how did you define that field? I hope you defined accesstime
as timestamp. Read on the definition of timestamp fields.
>> 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);
look for count(*) as ... in the manual.
--
Herzlich
Werner Stuerenburg
_________________________________________________
ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen
Tel 0(049) 5224-997 407 · Fax 0(049) 5224-997 409
http://pferdezeitung.de
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php