Answer the question
In order to leave comments, you need to log in
SQL query: how to select records in the range from today to the end of the week?
There is a table with attribute "date". I need to get from this table only those records that are in the range from today to the end of the week.
Found a similar query
Answer the question
In order to leave comments, you need to log in
....
WHERE `date` BETWEEN CURDATE()
AND DATE_ADD(CURDATE(), INTERVAL 7-WEEKDAY(CURDATE()) DAY)
SELECT * FROM `table` WHERE STR_TO_DATE(`date`, '%d.%m.%Y') >= CURDATE() AND STR_TO_DATE(`date`, '%d.%m.%Y') <= CURDATE() + INTERVAL 7 DAY
If you need any other day of the week, then replace 8 with another number.
SELECT *
FROM `table`
WHERE (`data` >= DATE(NOW()) AND
`data` <= DATE (DATE('Y-m-d') + INTERVAL (8 - DAYOFWEEK(DATE('Y-m-d'))) DAY));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question