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)
 Dealing with date intervals

Author  Topic 

drakull
Starting Member

12 Posts

Posted - 2001-02-03 : 08:39:47
I have a table with shows and events, it have 2 date fields, one for the start date (STARTDATE) and other for the end date (ENDDATE) they are smalldatetime fields.

Some events will have both start and end dates (events that lasts for some days), others will have just the start date field filled. These are events that ends at the same day it starts.

I need to create a query to select all events that start OR are still running at a given date. But I can only think on a way to select events that start at a given date:

SELECT * FROM events WHERE startdate BETWEEN 'mm/dd/yy 00:00' AND 'mm/dd/yy 23:59'

Note that when the event doesn't lasts for more than a day the ENDDATE field is NULL and that i use the TIME part of the STARTDATE field to display the time the event starts at each day.

Thanks for your time.

----------
Henrique

Edited by - drakull on 02/03/2001 08:43:09
   

- Advertisement -