dif_dataactivation_fimdegus is a range of the difference between 2 date fields, which I return, for example, -1 day.
I would like to know how I can make a count of all records that are negative in this column.
dif_dataactivation_fimdegus is a range of the difference between 2 date fields, which I return, for example, -1 day.
I would like to know how I can make a count of all records that are negative in this column.
Data is missing but will be something like this
testing only negative values
select count(dif_dataativacao_fimdegus) soma
from tabela
where dif_dataativacao_fimdegus <= -1
or
Treating a column with only negative values
select count(case when dif_dataativacao_fimdegus <= -1 then
dif_dataativacao_fimdegus else null end) soma_do_neg,
count(dif_dataativacao_fimdegus) soma
from tabela
Post-observation of @ramaral, I believe this to be, but I repeat it was unclear, at least for me) the doubt.