D
D
Dmitry Kuzmin2015-01-26 08:58:46
MySQL
Dmitry Kuzmin, 2015-01-26 08:58:46

How to execute a query to select records from Wednesday to the current day?

There is a table, it stores dates in YYYY-MM-DD format, you need to select records from the last Wednesday to the current day. I can not figure out how to designate the past environment in the request.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2015-01-26
@Nc_Soft

It is necessary to calculate the past environment for the jap that is used, and make the query
where createdAt between '2015-01-21' and '2015-01-26'
Why is that? To use the index on the selected field.
If the interest is purely academic, and not practical, then you should look at the functions for working with dates in the manual.

D
Dmitry Kuzmin, 2015-01-26
@Dimkaa

Yes, the interest is just practical. Of course, I would do date detection in PHP, but I would like to do it right away in the request.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question