Quote:
Originally posted by cmptrguru7
I am hoping someone can help me. I am trying to do a query to gather some information. My database is set up like:
person table:
Person ID
Last Name
First Name
...
Customer table:
Cust_ID (foreign key links to Person ID)
Location
Employee ID (foreign key links to employee table)
...
Employee Table:
Employee ID (foreign key links to Person ID)
....
there is other information in the tables, but this is enough to get what I want. I am trying to write a query to give me the employee name and which customers coorespond to that employee. I need both the employee and customer names as well as the csutomer location. Does anyone have an idea on how to accomplish this.
|
Something like:
select p.last_name, c.cust_name, c.location
from person p, employee e, customer c
where p.person_id = e.person_id
and e.employee_id = c.employee_id
order by p.last_name, c.cust_name;