How to query dates between two dates in the same column in MySQL
P粉083785014
P粉083785014 2023-09-05 21:17:10
0
1
569
<p>I have a table called holiday_master with the following columns</p> <pre class="brush:php;toolbar:false;">| Id | Title | Date | |:---|:-------|:------------------------| | 1 | Christmas | 12-25-2021 - 12-30-2021 | | 2 | Celebration Festival | 11-30-2021 - 12-02-2021 |</pre> <p>Suppose I have the current date 2021-12-27, it appears in the first row, I want to get that record, thank you in advance :)</p>
P粉083785014
P粉083785014

reply all(1)
P粉245003607

Poor database design can cause many problems. Your database is unavailable. Date should be in timestamp or date format split into two columns: start_date and end_date

Then you can execute

SELECT * FROM holiday_master WHERE start_date < :date AND end_date > :date
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template