ms sql where

I have to date time columns  I need to be able to have the time difference between these two columns to be less than 3 mins
 not sure where to look
LVL 2
beridiusAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Need more info to answer your question.

Are both of these columns populated with dates?
If yes, does this mean you want to update the value in column2 with a datetime value that is three minutes different from column1?
0
beridiusAuthor Commented:
I am think on the lines of (DATEDIFF(MINUTE,job_start,job_end)<3)
0
tigin44Commented:
where DATEDIFF(MI, col1,col2)  < 3
0
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Correct, you can get the difference in minutes between two datetime values using datediff.
SELECT DATEDIFF(MINUTE,'2013-09-23',GETDATE()) 

Open in new window

Now you'll need to answer the questions I posted above to tell describe your needs in further detail.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott PletcherSenior DBACommented:
Because of the way DATEDIFF works, I think this what you actually need to use:

DATEDIFF(SECOND, job_start, job_end) < 180
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.