Reputation: 393
I'm sure there is an answer out there for this, I am just having a hard time explaining what exactly it is I am looking for making it really hard to research:
I basically have 2 tables:
Table A:
PrimaryKeyID
SalesmanID
ManagerID
Table B:
List of all employers with ID being the primary key (auto incremented from 1)
I need to get both the Salesman and Manager Names from Table B, from a specific row in table A. Consider Table A like a transaction log.
Upvotes: 0
Views: 23
Reputation: 28
Just a way to do it
SELECT A.ID, SalesMan.NAME, Manager.NAME
FROM TableA A
LEFT JOIN TableB SalesMan ON SalesMan.Id= A.SalesmanID
LEFT JOIN TableB Manager ON Manager.Id= A.ManagerID
WHERE (A.Your condition here)
AND (SalesMan.SalesmanID IS NOT NULL OR Manager.ManagerID IS NOT NULL)
Upvotes: 1