On Tuesday 17 December 2002 09:39, Troy Kruthoff wrote: > Invalid reporting of date calc > > >How-To-Repeat: > > note: SESSIONTS is TIMESTAMP type > > SELECT (NOW()-SESSIONTS) FROM WEBSESSIONS; > +-------------------+ > > | (NOW()-SESSIONTS) | > > +-------------------+ > > | 1261 | > > +-------------------+ > 1 row in set (0.00 sec) > > mysql> SELECT (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(SESSIONTS)) FROM > WEBSESSIONS; > +---------------------------------------------------+ > > | (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(SESSIONTS)) | > > +---------------------------------------------------+ > > | 748 | > > +---------------------------------------------------+ > 1 row in set (0.00 sec) > > >Fix: > > Cast fields as UNIX_TIMESTAMP to get valid seconds between to periods.
It's not a bug. You can't apply arithmetics directly on the datetime fields. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com --------------------------------------------------------------------- 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