1
Good evening, I have a table with 4 fields and through them I do some calculations and create a new field to show these same results... The problem is that then I want to get those results and I don’t know how I can rescue them.
declare @mesAtual as int = (6)
select mes,
valor,
periodicidade ,
cast(valor / periodicidade as decimal(18,2)) as ValorMes,
case when @mesAtual > mes then @mesAtual - mes
when @mesAtual < mes then (periodicidade - (mes - @mesAtual)) + 1
when @mesAtual = mes then 0 end as Diferenca
from tblPrevista
I suggest that you paste in the question the code of your SQL query beyond the image, so whoever helps you can copy the query more easily.
– Ana Carolina Manzan
You’re absolutely right, thank you for the suggestion. @Ana Carolina Manzan
– Diogo Sousa