0

谁能给我一个解决方案我怎样才能发出一个sql请求来比较我的数据库中的日期

SELECT * FROM my table WHERE date between YY.MM.DD HH.MM.SS AND YY.MM.DD HH.MM.SS

谢谢

4

1 回答 1

1

您没有说明您的 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
于 2012-05-17T12:14:22.983 回答