5
I have a company call database, for example let’s say the table has only:
-- TABELA CHAMADO -- id (id do chamado) inicio (data de inicio do chamado) id_criador (id do usuário que abriu o chamado) ----------------------------------------------
I need to elaborate a select that tells me how many calls each user opened on each day of the month, returning 0 if he hasn’t opened any, for example.
id_criador dia qnt 1 2018-08-01 7 1 2018-08-02 0 1 2018-08-03 6
I have already found in other topics the command
generate_series(DATE'2018-08-01',DATE'2018-08-31',INTERVAL'1 day')that returns to me every day of the month, but I am not able to join this result with the data of the so-called table. What would be the best way to do that?
Thank you very much, it worked perfectly. I just changed the second select to disregard the hours. SELECT date_trunc('day', start) start, COUNT(*) qnt, id_creator FROM called GROUP BY id_creator, date_trunc('day', start)
– Alécio Gomes