OT: SQL Integer Math not working

Bob Sneidar bobsneidar at iotecdigital.com
Mon Mar 20 15:55:00 EDT 2017


NVM. The solution was to first set the result column to signed, then cast the start and end mileage to signed. Turns out one of my techs does not get the concept that when a dialog pops up telling him that he cannot have negative mileage, it doesn't occur to him, "... and therefore I've made an error and need to correct it." 

Bob S


> On Mar 20, 2017, at 12:42 , Bob Sneidar <bobsneidar at iotecdigital.com> wrote:
> 
> Hi all. 
> 
> I have 3 columns all defined as INT(10) unsigned default 0. I attempt this sql statement:
> 
> update service set totalmileage = endmileage - startmileage
> 
> I get the error: Error Code: Error Code: 1690. BIGINT UNSIGNED value is out of range in '(`formsgen`.`service`.`endmileage` - `formsgen`.`service`.`startmileage`)'
> 
> I used a where clause to elminate possible NULL values, as well as excluding records where startmileage or endmileage <= 0. I cannot get around this. WTH?? This should be really straight forward. I also tried casting both as unsigned but no workie. 
> 
> Bob S
> 
> 
> 





More information about the use-livecode mailing list