Conditional SELECT MySQL
- by user188693
Don't know if this is possible, but I'd like to select records based on the field value of recur_type, where the 'm' is the day of the week. If it's a weekly recurring event, I need to make sure this is a day it recurs on, otherwise, I want to return all days. however, I'm getting an empty result set:
SELECT *
FROM wp_fun_bec_events
WHERE start_date <= '2009-10-12'
AND ( end_date >= '2009-10-12'
OR (recur_end > '0' AND recur_end >= '2009-10-12' ) )
AND ('m' IN (
CASE WHEN 'recur_type' = 'weekly'
THEN recur_days
ELSE 's/m/t/w/r/f/a'
END ) )
ORDER BY start_date, start_time
Any ideas??