Field from table in same table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a table (tbl_employees) with the following fields

ID
[F]irstName
urname
Name [F&S]
Reports_To

All the reports_to people are in the same table. I'm trying to create a
query with all the above fields but also a ID_Of_Reports_To field. I'm not
having much luck and keep going round in circles. I've tried adding the table
twice and joining name to name and dragging in ID from the secod table and
that sort of thing.

Can anyone help.....thanks in advance
 
Hi

I have a table (tbl_employees) with the following fields

ID
[F]irstName
urname
Name [F&S]
Reports_To

All the reports_to people are in the same table. I'm trying to create a
query with all the above fields but also a ID_Of_Reports_To field. I'm not
having much luck and keep going round in circles. I've tried adding the table
twice and joining name to name and dragging in ID from the secod table and
that sort of thing.

Can anyone help.....thanks in advance


Is the Reports_To field a Long Integer field that stores the ID of the
person each record is reporting to?

Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
 
Hi

Its a text field, same as Name


thanks
--

_______________________
Naz,
London


Lynn Trapp said:
Hi

I have a table (tbl_employees) with the following fields

ID
[F]irstName
urname
Name [F&S]
Reports_To

All the reports_to people are in the same table. I'm trying to create a
query with all the above fields but also a ID_Of_Reports_To field. I'm not
having much luck and keep going round in circles. I've tried adding the table
twice and joining name to name and dragging in ID from the secod table and
that sort of thing.

Can anyone help.....thanks in advance


Is the Reports_To field a Long Integer field that stores the ID of the
person each record is reporting to?

Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
 
Hi

Its a text field, same as Name


thanks

Then give this a try:

SELECT A.ID,
A.FirstName,
A.Surname,
Name,
(SELECT X.Reports_To
From tbl_employees AS X
Where X.Reports_To = A.Name) AS ReportsTo
From tbl_employees AS A;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top