18446744073709551615 is a big number, and if it’s showing in your result set, it’s probably not correct.
The big numbers show up when you subtract unsigned integer values (two numbers that aren’t suppose to have negative values).
It’s a quick fix:
Use the CAST method to convert the equation to signed:
SELECT CAST( row1 - row2 AS SIGNED) as row_remainder FROM table
Where I learned it: While working on Intwition. Found the solution on the VerySimple Dev Blog. (Provides more details into why/how this works)
Comments
Leave a Reply