Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
谁能给我一个解决方案我怎样才能发出一个sql请求来比较我的数据库中的日期
SELECT * FROM my table WHERE date between YY.MM.DD HH.MM.SS AND YY.MM.DD HH.MM.SS
谢谢
您没有说明您的 DBMS,所以这是 ANSI 版本:
SELECT * FROM my_table WHERE date between timestamp '2012-05-01 18:00:00' AND timestamp '2012-05-19 23:00:00'
或者
SELECT * FROM my_table WHERE date between timestamp '2012-05-01 18:00:00' AND current_timestamp