Thanks, the query is now working, but....it is not producing the required results. I have now tried many different methods, it does not seem to me to be possible to compare these times!!
Thanks anyway Paul ----- Original Message ----- From: "Torgil Zechel" <[EMAIL PROTECTED]> To: "'p.whiter'" <[EMAIL PROTECTED]> Sent: Thursday, October 18, 2001 1:57 PM Subject: SV: newbie - questions about timestamp(14) : You seem to miss a comma: : : SELECT user_ip, IF(... : ^^^ : : > -----Ursprungligt meddelande----- : > Från: p.whiter [mailto:[EMAIL PROTECTED]] : > Skickat: den 18 oktober 2001 14:47 : > Till: MySQL List : > Ämne: Re: newbie - questions about timestamp(14) : > : > Thanks for your reply, I have tried using the query as you suggest, : see : > below: : > : > SELECT user_ip IF(TIME_TO_SEC(NOW()) - TIME_TO_SEC(log_time) < 300, : > 'true', : > 'false') FROM clinic_log : > : > But this just gives me an error, ie the query won't run? : > : > Does the query seem to be right? : > : > Thanks again : > Paul : > : > ----- Original Message ----- : > From: "Torgil Zechel" <[EMAIL PROTECTED]> : > To: <[EMAIL PROTECTED]> : > Sent: Thursday, October 18, 2001 11:54 AM : > Subject: SV: newbie - questions about timestamp(14) : > : > : > : You can use NOW() to get the current timestamp: : > : : > : mysql> select NOW(); : > : +---------------------+ : > : | NOW() | : > : +---------------------+ : > : | 2001-10-18 12:49:29 | : > : +---------------------+ : > : : > : But it would be easier to let MySQL calculate the elapsed time: : > : : > : select : > : IF(TIME_TO_SEC(NOW()) - TIME_TO_SEC(logged_ts) > 300, 'true', : 'false') : > : from <table>; : > : : > : where logged_ts is your logged timestamp and <table> is the name of : your : > : table.. : > : : > : /torgil : > : : > : > Hi all : > : > I'm having a problem getting a query to work where I want to : compare : > : the : > : > current_timestamp to the logged timestamp, and return false if : less : > : than : > : > 300 : > : > seconds, can you tell me if it is possible to have the current : > : timestamp : > : > returned as part of a query, so as I can then do my calculations : in my : > : > script. : > : > Thanks : > : > Paul --------------------------------------------------------------------- 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