开发者

Selecting between two dates within a DateTime field - SQL Server

开发者 https://www.devze.com 2022-12-14 19:41 出处:网络
How to select records between a date 开发者_StackOverflow社区to another date given a DateTime field in a table.SELECT *

How to select records between a date 开发者_StackOverflow社区to another date given a DateTime field in a table.


SELECT * 
FROM tbl 
WHERE myDate BETWEEN #date one# AND #date two#;


select * 
from blah 
where DatetimeField between '22/02/2009 09:00:00.000' and '23/05/2009 10:30:00.000'

Depending on the country setting for the login, the month/day may need to be swapped around.

0

精彩评论

暂无评论...
验证码 换一张
取 消