I have the following table:
+------------+--------------+-------------------+
| ID | vacina | data |
+------------+--------------+-------------------+
| 1 | Cinomose |2017-07-10 10:11:15|
+------------+--------------+-------------------+
| 2 | Coronavirose |2017-08-09 10:11:15|
+------------+--------------+-------------------+
| 3 | Vermifugo |2017-10-10 10:11:15|
+------------+--------------+-------------------+
| 4 | Anti-pulgas |2017-07-25 10:11:15|
+------------+--------------+-------------------+
| 5 | Anti-rábica |2017-06-06 10:11:15|
+------------+--------------+-------------------+
| 6 | V4 |2017-07-10 10:11:15|
+------------+--------------+-------------------+
I would like a query that returns me the amount of vaccines I have on the day compared to the current month, considering that today it is 2017-07-25
. For example:
+------------+-------------------+
| qnd | data |
+------------+-------------------+
| 2 |2017-07-10 10:11:15|
+------------+-------------------+
| 1 |2017-07-25 10:11:15|
+------------+-------------------+
My initial initiative was as follows:
SELECT COUNT(*) as qnd, datetime_start as date FROM 'tbl_delivery' GROUP BY datetime_start
However, it does the process of counting and grouping but returns data for all the months that are contained in the table.
Try to use this question from: how to fetch records saved in the current week , but the grouping did not work.
What would be the most feasible way to retrieve all data from the current month grouped by date?