My query return like below
date count
November 19,2019,11:58 PM 2
November 19,2019,11:59 PM 2
November 20,2019,12:02 AM 2
Is there any way to do like
November 19,2019 4
November 20,2019 2
Seems your date is not a standard mysql date time format. We need to format it first using str_to_date
function.
select cast(str_to_date(dateC, '%M %d,%Y,%h:%i') as date), count(1) from Test
group by cast(str_to_date(dateC, '%M %d,%Y,%h:%i') as date)
see dbfiddle .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.