SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select between getdate() and (getdate() - 2 min)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

esambath
Yak Posting Veteran

India
88 Posts

Posted - 08/10/2009 :  11:27:35  Show Profile  Reply with Quote
Hi Friends,

I need to select the records which are all between the currentdatetime
and the 2 minutes before the currentdatetime.

please help me to get the query.

Thanks in advance

bklr
Flowing Fount of Yak Knowledge

India
1693 Posts

Posted - 08/10/2009 :  11:43:28  Show Profile  Reply with Quote
where date between GETDATE()and dateadd(mi,-2,getdate())
Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

USA
472 Posts

Posted - 08/10/2009 :  11:45:20  Show Profile  Reply with Quote
should'nt it be between MIN and MAX? instead of MAX and MIN?
Go to Top of Page

vijayisonly
Flowing Fount of Yak Knowledge

USA
1836 Posts

Posted - 08/10/2009 :  11:45:42  Show Profile  Reply with Quote
where datediff(mi,<urcolumn>,getdate()) <= 2
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000