Answer the question
In order to leave comments, you need to log in
Why doesn't the select work?
I want to select:
All events for the current month, what's wrong?
SELECT * FROM `event` WHERE MONTH(ends_at) = MONTH(CURRENT_TIMESTAMP)
SELECT * FROM `event` WHERE ends_at <= curdate() - INTERVAL DAYOFWEEK(curdate())+6 DAY AND ends_at > curdate() - INTERVAL DAYOFWEEK(curdate()) - 1 DAY
SELECT * FROM `event` WHERE DATE(ends_at) >= CURDATE()
Answer the question
In order to leave comments, you need to log in
I forgot that this is a timestamp, and therefore:YEARWEEK(FROM_UNIXTIME(starts_at))
Is it possible to see at least a couple of lines from the 'event' table?
In theory, everything is correct if the ends_at field is of type date or datetime
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question