Click here to Skip to main content
15,919,422 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 2-Aug-13 18:56pm
v2

1 solution

C#
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:
 
Share this answer
 
Comments
Nawab Ahmad 3-Aug-13 2:06am    
Hi,
Yaaa working...
But i want to display the record of full month..so i have to search for every day by day and display..
plz help..
Nawab Ahmad 3-Aug-13 2:30am    
Hello..
i have 1 table name EMP contains tow columns ID and Name
and i have other table Info Contain three Columns ID NAME and AGE.
now i have many id in INFO table so want to search and insert Names of that IDs present in INFO table from EMP table......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900