質問

Looked up of all questions about error with minus operator in MYSQL and can't find solution. all given solutions not working. i`m trying to get difference between Units In Stock and Units On Order and my query like this:

$sql = "SELECT   UnitsInStock - UnitsOnOrder as 'Difference'
        FROM products ";

why i got this error?

 Warning: mysqli_query(): (22003/1690): BIGINT UNSIGNED value is out of range
役に立ちましたか?

解決

You can try this one:

SELECT CAST(UnitsInStock AS SIGNED) - CAST(UnitsOnOrder AS SIGNED) as 'Difference' FROM products
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top