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 it give me the result of the sum of the column Patsaldobem
, along 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