0
I’m trying to make a select to pick a week back from today. That’s what I’ve come up with?
select count(id) as total, (current_date - interval '7') as testando, extract(day from data_cadastro) as date_part,extract(month from data_cadastro) as date_part_month
from ris_atendimento as a
group by
extract(day from data_cadastro), extract(month from data_cadastro)
order by
date_part asc;
Have tried using (CURRENT_DATE - INTERVAL '7 DAYS'), instead of just (current_date - interval '7')?
– Couper
If you just want to catch "a week back from today" then you need to put such a condition in the WHERE.
– anonimo
explain better exactly what you want and the expected result basically the 7 days would be just like this:
select 
count(id) as total,
(current_date - interval '7 days') as testando
from ris_atendimento as a
otherwise try to complement.– Doan Casotti