Saturday, 31 August 2013

MySQL select daterange data from two coloms

MySQL select daterange data from two coloms

This is my tables
ut_period
id | month | year | name
1 | 9 | 2013 | dddd
2 | 2 | 2017 | eeee
I want select rows witch in 2013-8 and 2018-9. So i wrote following query.
But it is not successful.
SELECT * FROM `ut_period` p
WHERE `p`.`status` = 4
AND `p`.`year` >= '2013'
AND `p`.`mont` >= '8'
AND `p`.`year` <= '2018'
AND `p`.`month` <= '9'
How can i do it?

No comments:

Post a Comment