I make a select in MySQL and search between 2 dates and make a count of elements by date and it works fine but, if a date has no records it does not appear, what I'm looking for is something like this:
Column date / Count
- 2017-01-01 / 1
- 2017-01-02 / 2
- 2107-01-03 / 0 *Date without records
- 2017-01-04 / 1
What I get
- 2017-01-01 / 1
- 2017-01-02 / 2
- 2017-01-04 / 1
2017-01-03 does not show because has no records
Query:
SELECT I.FechaInstalacion, count(Case when I.ServicioId = 1 then 1 end) as P
FROM Instalacion I
WHERE I.EmpleadoId = 4 and I.FechaInstalacion>='2018-01-01' and
I.FechaInstalacion<= '2018-01-31'
group by I.FechaInstalacion
Thank you!