mysql 年月日不同字段 如何按照区间筛选如题 有趣的题 如何快速查询且准确eg: id month day
1 5 1
2 5 6
3 6 19
4 7 1
5 7 2筛选出5月6号-7月1号的id
2 回答
![?](http://img1.sycdn.imooc.com/545862e700016daa02200220-100-100.jpg)
至尊宝的传说
TA贡献1789条经验 获得超10个赞
通用开始,中间连续,结束三段union
select id from tbl where month = 5 and day >= 6union select id from tbl where month > 5 and month < 7union select id from tbl where month = 7 and day <= 1
针对特殊日期
select id from tbl where month = 5 and day >= 6union select id from tbl where month = 6union select id from tbl where month = 7 and day = 1
- 2 回答
- 0 关注
- 776 浏览
添加回答
举报
0/150
提交
取消