Mysql关于日期Sql
Mysql查询某段日期上午或下午的数据
-- 查找当天上午的数据 select * from nice where 1=1 and time BETWEEN '2020-07-20 08:29:28' and '2020-07-24 08:29:28' and DATE_FORMAT(time,"%H")>='00' and DATE_FORMAT(time,"%H")<='12'
Sql主要所用的函数为 DATE_FORMAT(date,format),参考网址:https://www.w3school.com.cn/sql/func_date_format.asp