If you have a calendar table, then your problem is solved:
SELECT DATE(`date`) AS RegistrationDate, COUNT(u.id) AS NumberOfRegistrations
FROM Calendar c LEFT JOIN
Users u
ON DATE(u.date) = c.date
WHERE c.date >= '2018-05-01' AND c.date < '2018-05-14'
GROUP BY RegistrationDate;
A Calendar
table can be quite useful and you can find one with a Google search.
You can do something similar with a numbers
table, if you happen to have one handy.
Absent those, you can generate the dates you want:
SELECT DATE(`date`) AS RegistrationDate, COUNT(u.id) AS NumberOfRegistrations
FROM (SELECT DATE('2018-05-01') as dte UNION ALL
DATE('2018-05-02') as dte UNION ALL
DATE('2018-05-03') as dte UNION ALL
DATE('2018-05-04') as dte UNION ALL
DATE('2018-05-05') as dte UNION ALL
DATE('2018-05-06') as dte UNION ALL
DATE('2018-05-07') as dte UNION ALL
DATE('2018-05-08') as dte UNION ALL
DATE('2018-05-09') as dte UNION ALL
DATE('2018-05-10') as dte UNION ALL
DATE('2018-05-11') as dte UNION ALL
DATE('2018-05-12') as dte UNION ALL
DATE('2018-05-13') as dte UNION ALL
DATE('2018-05-14') as dte
) c LEFT JOIN
Users u
ON DATE(u.date) = c.dte
WHERE c.dte >= '2018-05-01' AND c.dte < '2018-05-14'
GROUP BY RegistrationDate;
Notes:
- Use standard date formats for dates YYYY-MM-DD.
- The standard string delimiter in SQL is the single quote. Use it, unless you have a good reason for using double quotes.
- Don't use
between
with dates. It is unclear whether you intend to include 2018-05-13, but your query will probably exclude any data on that date (due to the time component).