troubleshooting Question

MSSQL - Choosing between which date is closer to the value in sql

Avatar of Brock
BrockFlag for Canada asked on
Microsoft SQL Server
4 Comments3 Solutions446 ViewsLast Modified:
Is possible in sql to choose which field date (start or end )  in a record is closer to a particular value ie. July 1, 2013.

Need to compare one date to the next in the record; ie which is the greatest . Then specify the value ie in the where clause (with an or statement)

In general what type of solution is needed.  I am just doing some feedback and working on getting the answer :-).


start date: May 1, 2013
end date : May  2, 2013

Date closes to : July 1, 2013


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros