I have an assignment table with the union code details as follows -
ASG
NUMBER START_DATE END_DATE POSITION UNION CODE MANAGER
10 01-JAN-2006 17-AUG-2017 MANAGER 6790 Cyndy
10 18-AUG-2017 10-JUL-2018 SUPER MANAGER 6790 Cyndy
10 11-JUL-2018 31-12-4712 SUPER MANAGER 6791 Cyndy
10 01-JAN-2006 07-AUG-2017 associate 6790 Bali
10 08-AUG-2017 10-JUL-2019 sr. associate 6790 Bali
10 11-JUL-2019 31-12-4712 MANAGER 6790 Bali
I tweak the below query such that I can find the first date when the latest union code was tagged to the employee. So the output should look like -
NUMBER START_DATE POSITION UNION CODE MANAGER
10 11-JUL-2018 SUPER MANAGER 6791 Cyndy
10 01-JAN-2006 associate 6790 Bali
I am using the below query to find the latest row but I need the first date when the union code was tagged-
select NUMBER, START_dATE,POSITION,UNION_CODE,MANAGER from
asg
where sysdate between start_Date and end_date