if value of field is less by 3 points of another field Sql
Clash Royale CLAN TAG#URR8PPP
if value of field is less by 3 points of another field Sql
I have an alert that goes out when I have an order Id when the Cost is less then the price. But I need to get the alert only if the Cost is less by at least $3. This is what I have so far, it works, but I need to figure out how to show the alert only if the Cost is $3.00 less or more then the Price.
if@OrderID > 0 and (@Cost < @Price)
So to be clear if the Cost is less then the Price by $3 or more. Both are money datatypes.
MSSMS is the one i am working with
– quicklaunch2009
Aug 6 at 14:55
2 Answers
2
if the module of result is more than 2.
if@OrderID > 0 and (ABS(@Cost - @Price) >= 3)
That same line, but subtract $3 from price like this:
if@OrderID > 0 and (@Cost <= @Price - 3)
if@OrderID > 0 and (@Cost <= @Price - 3)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Which dbms are you using?
– jarlh
Aug 6 at 14:54