Something strange here...

Chris Knipe <[email protected]> Wed, 14 Jun 2017 00:42:06 +0300
Newsgroups gmane.comp.db.mysql.general
Message-ID <[email protected]>
Hi all,

Can someone explain to me why this is happening please:

mysql> SELECT * FROM CustomerDetails WHERE Username=’blah’\G
*************************** 1. row ***************************
         EntryID: F83D4109-DCA8-426F-98B1-00B4AF117ACB
        Username: blah
   AccountVolume: 0
1 row in set (0.00 sec)

mysql> UPDATE CustomerDetails SET AccountVolume=GREATEST(CAST(AccountVolume-2865 AS SIGNED), CAST(0 AS SIGNED)) WHERE Username='blah';
ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in '(`test`.`CustomerDetails`.`AccountVolume` - 2865)'

Using GREATEST, shouldn’t it be irrelevant whether AccountVolume-INT is signed or unsigned?

How would I go about doing this?  I have played quite a bit with CAST here, but I am not having much luck.

Thnx,
Chris.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql