i want the record of employee who applied leave form '2016-03-16' date to '2016-03-25' date. But when i will write my query in which i would mention the between clause in where condition,like i mention the date
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';
it will show me result like
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,
but also when i will write my query like
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';
it have to show me the same result indicating that you have already applied for this dates. i.e it will show the same result:
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,