I know this is not the perfect approach but is there a problem
when comparing dates in MySQL and other DBs to just use Y-m-31 as
the last day of the month?
For example
SELECT * FROM orders WHERE date > 2015-02-01 AND date < 2015-02-31
You can use the MySQL LAST_DAY() function for this:
SELECT * FROM orders WHERE date >= '2015-02-01' AND date <= LAST_DAY('2015-02-01')
(you probably also want >= and <= instead of excluding the first/last days of each month)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With