I'm not sure how to phrase this. Please excuse the crudeness of my description.

I'm storing calendar data in a MySQL database and I'm wondering, is there a 
way to specify a day, such as the 28th, and "fourth" "Tuesday" as search 
criteria when selecting rows from a table with a field of type date?

Or...

Another approach, is there a way to tell what week and day a given date 
falls on? For example, is there a way to find out that today, the 28th, is 
the 4th Tuesday and select all rows that meet this criteria?

Here's what I'm trying to do if it helps. I have a table with the following 
fields:

DateStart date
DateEnd date
Recurring char(1) { Y or N }
RecurringWeek int(1) { 1 through 4; first, second, third, forth }
RecurringDay int(1) { 1 through 7; Monday, Tuesday, Wednesday, etc. }

To select standard calendar entries from a specific day, I search for

DateStart >= $SomeDate AND
$SomeDate <= $DateEnd AND
Recurring = "N"

Now I'm looking for a way to identify recurring entries. Instead of 
selecting all records that fall within a time range, I need to narrow the 
focus by specifying a week and a day. For example, list all records from 
this month that fall on the fourth Tuesday.

Is this possible? If so, how?  A friend said he can easily do it in Oracle, 
so I know there's sure to be a way to do it in MySQL! *grin*

Thanks,

-Ed


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to