I have a database table with people identified by name, assignment and city. I have a second table that contains a hierarchical view of each work in the company in each city.
Suppose I have 3 people in a people table:
[name(PK),title,city]
Jim, Salesman, Houston
Jane, Associate Marketer, Chicago
Bill, Cashier, New York
And I have thousands of work / location type combinations in the assignment table, examples of which follow. You can see the hierarchical relationship as parent_title is the foreign key to the header:
[title,city,pay,parent_title]
Salesman, Houston, $50000, CEO
Cashier, Houston, $25000
CEO, USA, $1000000
Associate Marketer, Chicago, $75000
Senior Marketer, Chicago, $125000
.....
The problem that I encountered is that my Person table is a composite key, so I don’t know how to structure part of start withmy query so that it starts with each of the three tasks in the cities I specified.
, , , . :.
select * from jobs
start with city = (select city from people where name = 'Bill') and title = (select title from people where name = 'Bill')
connect by prior parent_title = title
UNION
select * from jobs
start with city = (select city from people where name = 'Jim') and title = (select title from people where name = 'Jim')
connect by prior parent_title = title
UNION
select * from jobs
start with city = (select city from people where name = 'Jane') and title = (select title from people where name = 'Jane')
connect by prior parent_title = title
( , ) , ?