Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Need to get all rows based on hour difference > 2

Author  Topic 

sunilsi
Starting Member

21 Posts

Posted - 2008-12-11 : 23:18:57
Friends,

Please help me to derive a sql query with the below conditions.

TableName -> EducationDepartment

Columns -> empID, checkInTime (datetime).

I need to get all the employee ID's who's working hour is greater than 2 hours i.e GetDate() - checkInTime > 2.

Please help me on this.

Thx,
Linus

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-12-12 : 00:10:06
try like this,
select empid from EducationDepartment where datediff(hh,checkInTime,getdate()) > 2

ok tanx....
Go to Top of Page

sunilsi
Starting Member

21 Posts

Posted - 2008-12-12 : 00:40:07
Thanks friend!
Go to Top of Page

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-12-12 : 01:05:08
ok,
welcome
Go to Top of Page
   

- Advertisement -