1
I have the following sql code:
select PS.PatSldBemValResidAnt
,PS.PatSldBemValDepAcum
,Sum(PS.PatSldBemValDep) PatSldBemValDep
,Sum(PS.PatSldBemValResid) PatSldBemValResid
from Pat_Saldo_Bem as PS With(Nolock)
where PS.EmpCod LIKE '%01.14%'
and PS.PatBemCodRed = '0000351'
and ((PS.PatSldBemAnoMes >= '201807')
and (PS.PatSldBemAnoMes <= '201810'))
group by PS.PatSldBemValResidAnt, PS.PatSldBemValDepAcum, PS.PatSldBemValDep
How do I make him give me the result of the sum of the column Patsaldobem
, together with the highest value of PatSaldoDepAcum
?
I would like to show the column total PatSaldoBemValDep
which is the sum of the values 187.37+187.37+187.37
I suggest that, considering the data in the figure, you inform us how the result should be. For example: (1) what to do with the columns
PatSldBemValResidAnt
andPatSldBemValResid
? (2) the values shall be grouped by the columnPatBemCodRed
?– José Diz