1
dif_active date_fimdegus is a range of the difference between 2 date fields, which return me, for example, -1 day.
I wonder how I can make a Count of all records that are negative in this column.
1
dif_active date_fimdegus is a range of the difference between 2 date fields, which return me, for example, -1 day.
I wonder how I can make a Count of all records that are negative in this column.
0
Data is missing but it 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
After @ramaral observation, I believe this is it , but I repeat it was unclear 9at least to me) the doubt.
Review your answer because what AP wants is "a Count of all records that are negative in this column"
Browser other questions tagged sql
You are not signed in. Login or sign up in order to post.
Which DBMS is using?
– Vinícius Gobbo A. de Oliveira
Could you explain your first line better? dif_dataativaca_fimdegus would be a Function that returns the difference between dates?
– Marconi