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)
 selecting dates between selective dates of a particular month

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-02-08 : 07:54:46
surendra writes "We have a table where we are storing dates in two colums(startdate, enddate) for events. There are 4 or 5 rows or may be more for startdate and enddate. I need to select all the dates from that particular month which are not in the table

Ex: Id Startdate enddate
1 17/02/2007 20/2/2007
2 05/02/2007 8/02/2007
There will be more data for different years and date

1. i need to select max of date for that particular month.
2. date that are not in the table From EX -
dates not between(05/02/2007 to 8/02/2007) and
not between (17/02/2005 to 20/2/2007)"

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2005-02-08 : 16:01:33
Um... What? I'm not really sure what it is that you want.

It would be helpful if you could supply the actual table definitions, sample data (in the form of INSERT statements), expected outputs and some brief explanation of the business rules that are germane.

In general, though, it sounds like you may want to have a Calendar table. It would hold each date that you care about and would be used to select dates that are NOT in another table.

HTH

=================================================================
Egotism is the anesthetic that dulls the pain of stupidity. -Frank William Leahy, football coach (1908-1973)
Go to Top of Page
   

- Advertisement -