1.BETWEEN
SELECT id FROM m_question
WHERE cratedate
BETWEEN TO_DAYS(‘2019-05-31 00:00:00’)
and TO_DAYS(‘2019-06-01 00:00:00’)
ORDER BY id DESC
2 . > < 符号查询
SELECT id FROM m_question
WHERE cratedate
BETWEEN ‘2019-05-31 00:00:00’
and ‘2019-06-01 14:59:59’
ORDER BY id DESC
或者
SELECT id FROM m_question
WHERE cratedate >‘2019-05-31 00:00:00’
and cratedate < ‘2019-06-01 14:59:59’
ORDER BY id DESC
注意:
between and 包含时间界限,这就相当于>= <=,而> <不包含。
————————————————
版权声明:本文为CSDN博主「Tronhon」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_39213969/article/details/106054716