比较SQL中的时间 [英] Compare the time in sql

查看:72
本文介绍了比较SQL中的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们考虑时间的两个结局
a = 10:30
b = 12:30


正在从用户c = 11:45获得时间

我怎么能证明在SQL Server 2005中avalue和b值之间存在11:45?

let us consider two ends of time
a=10:30
b=12:30


am getting a time from user c=11:45

how can i show that 11:45 is existing between avalue and b value in sql server 2005

推荐答案

假设您有名为startTime和endTime的表列,并且它们都是SQL时间字段,请尝试:
Assuming you have table columns called startTime and endTime and the are both SQL Time fields, try:
SELECT * FROM myTable WHERE '11:45' BETWEEN startTime AND endTime


这可能对您有帮助

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=60675 [ ^ ]
This may help you

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=60675[^]


这篇关于比较SQL中的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆