I have this code in mssql:
SELECT
t1.Id,
t2.Id,
t1.QuantityIn,
t1.PriceIn,
t2.QuantityOut,
(If (t2.QuantityOut - t1.QuantityIn)=0
THEN t2.QuantityOut
Else t2.QuantityOut - t1.QuantityIn ) AS Quant,
t2.PriceOut
FROM t1
LEFT JOIN t2 ON t2.Id = t1.Id
In software MsSql Server Management Studio error is
Incorrect syntax near the keyword 'If'.
What is the correct syntax for 'if' in my case?
Thank you!
Aucun commentaire:
Enregistrer un commentaire