I have a table, where I am bringing two different results with the query below:
select sum(qtde_pontos) from dbo.tbl_cc_ponto where re = '9289'
and natureza_operacao = '2'
and data_lacto >= '2012-01-01'
and data_lacto <= '2017-08-10'
union
select sum(qtde_pontos) from dbo.tbl_cc_ponto where re = '9289'
and natureza_operacao = '1'
and data_lacto >= '2012-01-01'
and data_lacto <= '2017-08-10'
The output is as follows:
480.00
545.00
In this case, I would like to subtract the value 545.00 minus the 480.00 and the result of this (65.00), compare with another table that I have called: cc_voice_voice compared to the column . And this way bringing me if the result (65.00) is different from the column "current_score".
Is it possible to do this?
Thank you in advance.