SQL 列出特定日期之后的行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9532668/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
List rows after specific date
提问by Baz
I have a column in my database called "dob" of type datetime. How do I select all the rows after a specific DoB in SQL Server 2005?
我的数据库中有一个名为“dob”的日期时间列。如何在 SQL Server 2005 中选择特定 DoB 之后的所有行?
回答by cgatian
Simply put:
简单的说:
SELECT *
FROM TABLE_NAME
WHERE
dob > '1/21/2012'
Where 1/21/2012 is the date and you want all data, including that date.
其中 1/21/2012 是日期,您需要所有数据,包括该日期。
SELECT *
FROM TABLE_NAME
WHERE
dob BETWEEN '1/21/2012' AND '2/22/2012'
Use a between if you're selecting time between two dates
如果您选择两个日期之间的时间,请使用 between