Running the the following statement, I get an error with if statement in SQL Server 2014:
if MAX(A,OS) <> 0
MAX(A.OS) +
SUM(CASE WHEN TipoMovimento = 'E' THEN Quantidade ELSE 0 END) -
SUM(CASE WHEN TipoMovimento ='S' THEN Quantidade else 0 END)
AS ClosingStock
else
SUM(CASE WHEN TipoMovimento = 'E' THEN Quantidade ELSE 0 END)
as ClosingStock
Aucun commentaire:
Enregistrer un commentaire