Tratamento Data Select
Em uma tabela Oracle temos data no formato padrao yyyymmdd hh:mm:ss.
Quero gerar uma query:
Resultado está vindo assim:
01/2020 - 19
01/2020 - 02
02/2020 - 20
Como devo fazer pra que ele conte todos as datas de janeiro 2020?
Quero gerar uma query:
Select
to_char(data_inicio,''''mm - yyyy''''),
count(data_inicio)
from
eventos_1
where
data_inicio between to_date(''''01/01/2020'''''''',''''dd/mm/yyyy'''') and (sysdate)Resultado está vindo assim:
01/2020 - 19
01/2020 - 02
02/2020 - 20
Como devo fazer pra que ele conte todos as datas de janeiro 2020?
Marco Sousa
Curtidas 0
Respostas
Emerson Nascimento
06/06/2022
Select
to_char(data_inicio,''''mm - yyyy''''),
count(*)
from
eventos_1
where
data_inicio between to_date(''''01/01/2020'''''''',''''dd/mm/yyyy'''') and (sysdate)
group by
to_char(data_inicio,''''mm - yyyy'''')GOSTEI 0
Marco Sousa
06/06/2022
Select
to_char(data_inicio,''''''''mm - yyyy''''''''),
count(*)
from
eventos_1
where
data_inicio between to_date(''''''''01/01/2020'''''''''''''''',''''''''dd/mm/yyyy'''''''') and (sysdate)
group by
to_char(data_inicio,''''''''mm - yyyy'''''''')Sim, esqueci de copiar o Group by quando postei minha duvida, mas ele apresenta desta forma
01/2020 - 19
01/2020 - 02
02/2020 - 20
GOSTEI 0
Emerson Nascimento
06/06/2022
acabei de testar assim e funcionou:
select
to_char(data_inicio,'mm - yyyy'),
count(*)
from
eventos_1
where
data_inicio between to_date('01/01/2020','dd/mm/yyyy') and (sysdate)
group by
to_char(data_inicio,'mm - yyyy')GOSTEI 0