I have a table which has a Mysql DATE
field type.
I am searching the entries and need to sort the entries soonest first within the next 30 days. BUT, some o
Figured it out:
Answer
select b.name, ue.event_title, ue.event_date,
(DAYOFYEAR(ue.event_date) - DAYOFYEAR(CURDATE())) as days
from brains b
join user_events ue on b.user_id=ue.user_id
where b.user_id=63 and
MOD(DAYOFYEAR(ue.event_date) - DAYOFYEAR(CURDATE()) + 365, 365) <= 30
order by days asc