> >I need a WEEKOFMONTH function for a calendar query.  Does 
> anyone have such a function already?
> 
> What are the semantics?

What I need is the "first Monday of each month" type of function.

"WHERE
DATE_FORMAT(".$this->objE->_table.".cal_datetime, '%Y-%m-%d') 
<= DATE_FORMAT('$dt', '%Y-%m-%d') AND
WEEKDAY(".$this->objE->_table.".cal_datetime) = WEEKDAY('$dt') AND
".$this->objER->_table.".cal_end >= '$dt' And
".$this->objER->_table.".cal_type = 'monthlyByDay'"

This select works except it returns a date for each weekday such as Wed.
For example, it would return the first Wed of the month like...

"WHERE
DATE_FORMAT(".$this->objE->_table.".cal_datetime, '%Y-%m-%d') 
<= DATE_FORMAT('$dt', '%Y-%m-%d') AND
WEEKOFMONTH(".$this->objE->_table.".cal_datetime) = WEEKOFMONTH('$dt') AND
".$this->objER->_table.".cal_end >= '$dt' And
".$this->objER->_table.".cal_type = 'monthlyByDay'"



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to