mysql - Recurring Events occurrence -


i'm tring implement "crontab" recurring events,

i saw grate post calendar recurring/repeating events - best storage method

and created query (that works grate) :

select ev.* `events` ev  join `events_meta` em1      on em1.event_id = ev.id , em1.meta_key = 'repeat_start'  left join `events_meta` em2 on em2.meta_key = concat( 'repeat_year_', em1.id ) left join `events_meta` em3 on em3.meta_key = concat( 'repeat_month_', em1.id ) left join `events_meta` em4 on em4.meta_key = concat( 'repeat_week_im_', em1.id ) left join `events_meta` em5 on em5.meta_key = concat( 'repeat_weekday_', em1.id )  1=1     , (    em2.meta_value =2011   or em2.meta_value = '*'     )     , (    em3.meta_value =4      or em3.meta_value = '*'     )     , (    em4.meta_value =2      or em4.meta_value = '*'     )     , (    em5.meta_value =6      or em5.meta_value = '*'     )     , (    em1.start_date >= 1299132000                       ) limit 0 , 30; 

how write sql query date range select ... s => x , s <= y like

and

date       | eventid ---------- | ------- 12991..1   | 2 12991..2   | 2 12991..3   | 2 

my goal create "crontab" scheduler , occurrences between dates


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -