我想要申请休假表格的员工记录2016-03-16'约会到2016-03-25'日期。但是当我写下我的查询时,我会提到条件中的条款,就像我提到日期
select * from leave_form
where from_date and to_date between '2016-03-16' and '2016-03-25'
and status='yes' and emp_code='K0209';
它会显示我的结果
type, emp_code, rm_id, leave_bal, from_date, leave_from, to_date, leave_to, number, leave_for, status, applied_date, pendays, personal,
K0209, K0093, 10, 2016-03-16, full day, 2016-03-25, full day, 10, personal, yes, 2016-03-15,
但是当我写下我的查询时
select * from leave_form
where from_date and to_date between '2016-03-17' and '2016-03-17'
and status='yes' and emp_code='K0209';
它必须向我显示相同的结果,表明您已经申请了这个日期。 即它会显示相同的结果:
type, emp_code, rm_id, leave_bal, from_date, leave_from, to_date, leave_to, number, leave_for, status, applied_date, pendays
personal, K0209, K0093, 10, 2016-03-16, full day, 2016-03-25, full day, 10, personal, yes, 2016-03-15,
答案 0 :(得分:0)
你的问题令人困惑。这有帮助......
select *
from leave_form
where from_date > '2016-03-16'
and to_date < '2016-03-25'
and status ='yes'
and emp_code ='K0209';