×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Finding the ORIGINATING team of a client where the Current team is X?

Finding the ORIGINATING team of a client where the Current team is X?

Finding the ORIGINATING team of a client where the Current team is X?

(OP)
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

RE: Finding the ORIGINATING team of a client where the Current team is X?

Quote (SDS100UK )

. . . e t c
This works fine, but I cant figure out the logic to present the original team
And what conditions define the "original team"?
Post the query that base on a person just gets this "original team".
3eyes

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

RE: Finding the ORIGINATING team of a client where the Current team is X?

Does your db contain a Parent - Child data relationship?

Something like [This Team] and [Former Team]?

RE: Finding the ORIGINATING team of a client where the Current team is X?

(OP)
Hi....thanks for your responses.

The table has a client id as primary key. It then lists all the teams they have been assigned to. This row comprises client id, team id, start date and end date.

So it will have all teams in one table. I need to say in effect....show me the first team the client was assigned to for those who are in team ABC now.

Really hope you guys can help.

Steven

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close