MySQL Forums
Forum List  »  MyISAM

SELECT subtraction issue
Posted by: Andy CLyde
Date: January 12, 2006 05:49AM

I have just come across an odd issue when migrating from 3.23.58 on RHEL3 to 4.1.12 on RHEL4.
I had a query in my application like this:
SELECT (field1-field2-1) as new_stock FROM table WHERE table_id=XXX
where
field1 is SMALLINT(6)
field2 is TINYINT(3) UNSIGNED
This was working fine on the old server but on the new server, it's throwing up odd results where the result of (field1-field2-1) is negative.
For example, this query:
SELECT (field1-field2-1) as new_stock FROM table WHERE table_id=8477
(field1 and field2 are both zero in the database)
returns
new_stock = 18446744073709551615

Is this a bug? Or did something change from v3.23.58 to v4.1.12 that I haven't spotted that is causing this?
Thanks
Andy

Options: ReplyQuote


Subject
Views
Written By
Posted
SELECT subtraction issue
9506
January 12, 2006 05:49AM
2976
January 12, 2006 06:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.