Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / July 2003



Tip: Looking for answers? Try searching our database.

Time comparison In SQL....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John - 30 Jul 2003 23:50 GMT
People,

   Im trying (in SQL) to compare a user given start and end time to see if
it falls in between a start and finish time in a database.

I don't want the results if the start time or end time lies between these 2
times.

everything else before and after that is ok.

Any help is appreciated.

JC
Graham Dobson - 31 Jul 2003 15:56 GMT
>     Im trying (in SQL) to compare a user given start and end time to see if
> it falls in between a start and finish time in a database.
>
> I don't want the results if the start time or end time lies between these 2
> times.

WHERE fieldValue NOT BETWEEN table.StartTime AND table.EndTime

or

WHERE fieldValue < table.StartTime AND fieldValue > table.EndTime

-- Graham
Graham Dobson - 31 Jul 2003 16:02 GMT
> WHERE fieldValue < table.StartTime AND fieldValue > table.EndTime
>
> -- Graham

Oops should read

WHERE fieldValue < table.StartTime OR fieldValue > table.EndTime

as it would be hard to imagine a time both less than and greater than an
interval of time.  The important thing to realize is that the date/time
value is actually part of a floating point number like any other floating
point number with the date as the whole number and the time as the
raction.  -- Graham
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.