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!

Need query to find the records between two tables for a given date range

User_CPR6WMar 6 2022

I have a employee table which holds the information about which department the employee belongs during a period of time. At any point in a time a employee can belong to only one department. The end date column holds till what date the employee had stayed in a particular department. if the end date column holds a future date which means thats the latest department for a employee.
image.pngI have a call details table which holds the information of which employee took the call and what is call start time and call end time.
image.pngNow my question is:
I am looking for inputs and the sample query where i need to know what was the employees department during the time the employee took the call.
For example, if I want to know what are the calls took by an employee from jan-20-2022 to feb-02-2022 and what was there department name during the time of the call. i need the below output.
image.pngIf i run the query for a date range from feb-04-2022 to feb-10-2022, i want to see the below input
image.pngplease share few inputs on how to achieve this output using the sql query

Comments
Post Details
Added on Mar 6 2022
2 comments
435 views