select a.business_unit,a.calendar_code from
PS_MG_CALENDAR_WK a
where exists (select 'x' from ps_en_work_center b
where a.business_unit=b.business_unit and
a.calendar_code = b.calendar_code) or
exists (select 'x' from ps_en_crew c
where a.business_unit=c.business_unit and
a.calendar_code = c.calendar_code) or
exists (select 'x' from ps_en_machine d
where a.business_unit=d.business_unit and
a.calendar_code = d.calendar_code) or
exists (select 'x' from ps_en_tool e
where a.business_unit=e.business_unit and
a.calendar_code = e.calendar_code)
group by a.business_unit,a.calendar_code
|