I have this table named hr_holidays_by_calendar
. I just want to filter out the rows where the same employee is having two leaves in same day.
Table hr_holidays_by_calendar
:
Query I tried:
Wasn't anywhere near in solving this.
select hol1.employee_id, hol1.leave_date, hol1.no_of_days, hol1.leave_state
from hr_holidays_by_calendar hol1
inner join
(select employee_id, leave_date
from hr_holidays_by_calendar hol1
group by employee_id, leave_date
having count(*)>1)sub
on hol1.employee_id=sub.employee_id and hol1.leave_date=sub.leave_date
where hol1.leave_state != 'refuse'
order by hol1.employee_id, hol1.leave_date