Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Data based on Date conditions issue

4102954Oct 6 2019 — edited Oct 6 2019

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

Comments

Post Details

Added on Oct 6 2019
7 comments
163 views