如何在给定的时间范围内从数据库中获取员工的第一个条目。 [英] How to fetch the first entry of employee from database between the given range of time.
问题描述
我有一个表食堂它包含一列检查时间格式日期和时间将在员工出示他的卡后的日期时间。
Checktime = 6/30/2010 07:31
现在员工将显示他的卡片时间...但我想在他第一次在7:00到8:00和12之间显示他的卡时获取检查时间记录:00到1:00
意味着我只想显示第一个检查时间值将是7到8之间的第一个记录和12到1之间的第一个记录。
SELECT TOP 1 (您的DateTime字段)FROM table_name WHERE DateTime在x和y之间ORDER BY日期时间desc
这将为您提供第一次员工入场时间x和y(时间)
问候..:笑:
I have a table Canteen it contain one column Checktime format Datetime where date and time will come and sit after the employee show his card.
Checktime= 6/30/2010 07:31
Now employee will show his card number of time...But i want to fetch checktime record when he first time show his card between 7:00 to 8:00 and 12:00 to 1:00
means i want to show only to time the first checktime value will be the first record between 7 to 8 and first record between 12 to 1.
SELECT TOP 1 (your DateTime Field) FROM table_name WHERE DateTime Between x and y ORDER BY Datetime desc
This will give you the first time employee entry time betwenn x and y(time)
Regards..:laugh:
这篇关于如何在给定的时间范围内从数据库中获取员工的第一个条目。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!