On Monday 20 January 2003 08:22, Octavian Rasnita wrote: > But I don't want to perform a 15 - id, meaning 15 - 10. > I want to calculate 5 - id, meaning 5 - 10. > > It should give me -5 or 5 but not | 18446744073709551611 |
The result of the above expression is UNSIGNED, because column 'id' is INT UNSIGNED. If you want to get -5, use CAST() function in v4.0: mysql> select CAST(5 - id AS SIGNED) from test; +------------------------+ | CAST(5 - id AS SIGNED) | +------------------------+ | -5 | +------------------------+ 1 row in set (0.00 sec) or in 3.23 you can do: mysql> select 5 - (id+0.0) from test; +--------------+ | 5 - (id+0.0) | +--------------+ | -5.0 | +--------------+ 1 row in set (0.00 sec) For more info look at: http://www.mysql.com/doc/en/Cast_Functions.html -- 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