jkfrench
asked on
Help with joining a table twice
I have two tables where the first one relates to the second one from two fields, and I'm not sure how to set up a query properly. Tables look like:
I want to select the code and name for both the main and related code, so the output would have columns like this:
main.code | main.name | related.code | related.name
Could someone point me in the right direction?
TableA {
main_code
related_code
}
TableB {
code
name
}
I want to select the code and name for both the main and related code, so the output would have columns like this:
main.code | main.name | related.code | related.name
Could someone point me in the right direction?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sweet! Thank you for the quick reply, dkrollCTN.
I swapped out the table and field names for those in our database, and it does exactly what I needed.
I swapped out the table and field names for those in our database, and it does exactly what I needed.
ASKER
Thanks for your reply, too, ashilo.
from main , related
where main.JOINCOLUMN = releated.JOINCOLOUMN