Can anyone help me with this...
I have a field
ratingtotal bigint unsigned
The issue is that when the field value is 10 and I use the following query
UPDATE table
set ratingtotal = ratingtotal - 20
WHERE...
The above case is hypothetical.... my issue is that when I do this, MySQL instead of assigning 0 to the field, it assigns the highiest value of BIGINT - 20.
I am totally stumped....
Thanks for reading.
Issue with bigint unsigned
Moderator: General Moderators
-
ibizconsultants
- Forum Commoner
- Posts: 35
- Joined: Tue Sep 07, 2004 12:07 pm
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
makes perfect sense as that's how the operation would turn out in binary. I wouldn't expect MySQL to do range checking (as that can add a LOT to processing time)may work.
Code: Select all
UPDATE `table`
SET `field` = IF(`field` < 20, 0, `field` - 20)
WHERE ...-
ibizconsultants
- Forum Commoner
- Posts: 35
- Joined: Tue Sep 07, 2004 12:07 pm