Hi All,
I have employee table with 3 fields Empid,Join_Date,Term_Date.I need data based one below conditions on Join_Date and Term_Date.
1)Join_Date(can be latest as 30 days) should satisfy condition as,sysdate>=Join_Date<=sysdate+30 but Join_Date can not be greater than Term_Date
2)Term_Date(can be latest as 30 days)should satisfy condition as,sysdate>=Term_Date<=sysdate+30 but TERM_Date can not be less than Join_Date
I'm using below query.Please let me know is there any alternative way or correct me if it is wrong.I'm just started sql practice.
select emp_id,join_date,term_date
from employee
where join_date<=sysdate+30 and join_date<term_date
and term_date<=sysdate+30 and term_date>join_date