Hi guys,

In my application users can search for events that fall with in a particular date range, which works fine. The problem I am having is getting records when I ask for the current months events using the query below.

select * From Events
Where FromDate >='1/1/2010' And ToDate <=1/31/2010

I want the record below to show up because its start date is in the current month, but it doesn’t because of todate param is not less than 2/1/2010

eventid:1
eventname:vacation
fromdate:1/29/2010
todate:2/1/2010


How do a create a query that will give me only the records for the current month if the have a fromdate or todate within in a given time period. (ie current month, current week, etc.)

Thanks,


tom

Recommended Answers

All 2 Replies

Select *
From Events
Where (FromDate >= '01/01/2010' And FromDate < '02/01/2010')
Or (ToDate >= '01/01/2010' And ToDate < '02/01/2010')

thanks that did the trick

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.