需要从tblcolmn中查找时间,其中时间少于当前时间2小时 [英] Neeld to find time from a tblcolmn where time is less than 2 hours before the current time

查看:63
本文介绍了需要从tblcolmn中查找时间,其中时间少于当前时间2小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个名为tblactivity的表,其中有一个称为checkintime的列.
现在,我需要查找所有在当前时间的最后2小时内的签到时间.

Hi,
I have a table called tblactivity,where there is a column called checkintime.
Now I need to find all the checkin time which is within last 2 hours of the current time.
thanks in advance.

推荐答案

请尝试此查询...

TRY THIS QUERY...

SELECT * FROM tblactivity where DATEDIFF(hour,checkintime,GETDATE()) <= 2



希望它能帮助...



HOPE IT HELPS...


在查询后检查
check following Query
SELECT * FROM tblactivity WHERE checkintime BETWEEN DATE_SUB(NOW(), INTERVAL 2 HOUR)


这里是:

Here it is :

select * from tblactivity where checkintime > DATEADD(HOUR, -2, GETDATE()) 



祝你好运



Good Luck


这篇关于需要从tblcolmn中查找时间,其中时间少于当前时间2小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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