找我得到的数据开始日期和结束日期得到的开始日期和结束日期
之间的数据之间的数据,但我的要求是有点不同,请检查下面的数据库
我有两个文本boxs
1) start date
2) end date
数据库是这样
table name->purchase_order
sno start_date end_date
1 2017/08/01 2017/12/01
2 2017/08/01 2017/11/30
3 2017/09/01 2017/09/30
4 2017/09/01 2017/10/30
5 2017/10/01 2017/11/30
我想这样的
select *
from purchase_order
where start_date>= '2017/09/01' and start_date<= '2017/09/01'
OR end_date>= '2017/09/01' and end_date<= '2017/09/01'
输出我得到
sno start_date end_date
3 2017/09/01 2017/09/30
4 2017/09/01 2017/10/30
什么,我需要
,如果我这个2017年9月1日之间进行选择 - 2017年9月30日我想出来把这样{在ID “1”,在8月至12月间有9个月是有那么它也有前来}
sno start_date end_date
1 2017/08/01 2017/12/01
2 2017/08/01 2017/11/30
3 2017/09/01 2017/09/30
4 2017/09/01 2017/10/30
感谢
你能解释为什么当你只有2个输入源时你有4个子句吗? – Eli
你可以使用'BETWEEN'。 – Qirel