Hi,
I have sql written which will brings me back all the current members of team ABC.
In addition what I need is the team they originated in before moving to ABC. This may have been the team directly before or many team moves before.
What I have so far is:
-- Selects Non Employees from the Persons table to and find the relationships an
-- person has had
SELECT p.per_id,
p.per_first_names || ' '|| p.per_surname as Full_Name,
ou.oun_short_name,
ou.oun_name AS Team_Name,
ore.rel_start_date AS Rel_Start,
ore.rel_end_date AS Rel_End
FROM O_persons p
INNER JOIN o_relationships ore
on ore.rel_source_per_gro_id = p.per_id
INNER JOIN o_organisation_units ou
on ore.rel_to_per_gro_id = ou.oun_short_name
WHERE p.per_employee_ind = 'N' and ou.oun_short_name = 'ABC'
ORDER BY p.per_id, ore.rel_start_date desc;
This works fine, but I cant figure out the logic to present the original team.
Many thanks in advance,
Steven
I have sql written which will brings me back all the current members of team ABC.
In addition what I need is the team they originated in before moving to ABC. This may have been the team directly before or many team moves before.
What I have so far is:
-- Selects Non Employees from the Persons table to and find the relationships an
-- person has had
SELECT p.per_id,
p.per_first_names || ' '|| p.per_surname as Full_Name,
ou.oun_short_name,
ou.oun_name AS Team_Name,
ore.rel_start_date AS Rel_Start,
ore.rel_end_date AS Rel_End
FROM O_persons p
INNER JOIN o_relationships ore
on ore.rel_source_per_gro_id = p.per_id
INNER JOIN o_organisation_units ou
on ore.rel_to_per_gro_id = ou.oun_short_name
WHERE p.per_employee_ind = 'N' and ou.oun_short_name = 'ABC'
ORDER BY p.per_id, ore.rel_start_date desc;
This works fine, but I cant figure out the logic to present the original team.
Many thanks in advance,
Steven