34,590
社区成员
发帖
与我相关
我的任务
分享
SELECT * FROM `UserTable` WHERE convert(char(10),Time,120) <="2017-09-01" and convert(char(10),Time,120) >="2017-10-10"
SELECT * FROM `UserTable` WHERE date_format(Time,'%Y-%m-%d') >="2017-09-01" and date_format(Time,'%Y-%m-%d')<="2017-10-10"
这样没问题吧?测试了几个日期段都没问题
SELECT * FROM `UserTable` WHERE date_format(Time,'%Y-%m-%d') <="2017-09-01" and date_format(Time,'%Y-%m-%d') >="2017-10-10"
date_format好用啊
这样写对了吧?SELECT * FROM `UserTable` WHERE `Time` between '2017-09-01' and '2017-10-10'
SELECT *
FROM `UserTable`
WHERE convert(char(10),Time,120) <='2017-10-10'
and convert(char(10),Time,120) >='2017-09-01'