Ask a question about mysql and groupby grouping query. the data table field is of the datetime type, the saved value is 2009-02-10:20:11. I want to write an SQL statement for querying by number of days, that is, the number of records on the current day is two records, with the dates 2009-02-, respectively, 2009-02-the results show that the number of friends I know in is 2. I would like to thank you first-ask a mysql, group by date grouping query question.
The data table field is of the datetime type. the saved value is 12:20:11.
I want to write an SQL statement to query by number of days.
That is, how many records are there on the day?
There are two records with dates: 12:20:11, 22:20:11
Result Display
2009-02-10 quantity 2
Thank you!
------ Solution --------------------
SQL code
Select count (left (shijian, '10') as sl, left (shijian, '10') as sj from tablea group by sj