How to select entries with a date less than specified from the table in mysql. Field type with date varchar, date format 10/01/2015.
- 2redo the field to date. then everything will be trivial. And so you always have to bring the date to some more convenient format right in the request - and this ensures that any simple request will look for a complete table lookup, which will have the most sad effect on the speed of work - Mike
|
1 answer
This is how you can do it:
SELECT * FROM demo d WHERE STR_TO_DATE(d.date, '%d.%m.%Y') <= '20151003' - So does not choose - Vitali
- @Vitaly Strange, I had a sample. Can you throw a couple of records from your table? - Vlad Vetrov
- I apologize, figured it out. Just in the request it was necessary to use the period between two dates. Your example is correct, thank you. - Vitali
- @Vitaly - fuh fine, otherwise I’m already scared. - Vlad Vetrov
|