July 15, 2014 at 9:56 am
Hello --
I am coming up with a query that is meant to reference multiple tables within a single database. Currently there are two tables being queried in this process. The first contains the names of people, while the second lists identification numbers for them.
What I want to accomplish is to query the two tables, and have the results appear where the names of the people match the identification numbers assigned to each person.
How would I accomplish this?
Thanks.
July 15, 2014 at 10:23 am
July 15, 2014 at 11:10 am
Hello --
Thank-you for your reply. I tried several JOIN statements: INNER, LEFT, RIGHT, FULL OUTER, and while I was able to get a listing of the names, I did not get a listing of their associated identification numbers. The syntax that I used, aside from substituting the JOIN statements is the following:
SELECT <column name>
FROM <table 1>
RIGHT JOIN <table 2>
ON <table 1 column name>=<table 2 column name>
I need to have the contents of the table 1 column name side by side with those of the table 2 column shown in the output results.
July 15, 2014 at 11:21 am
You just need to add more columns to your query.
It might look something like this:
SELECT p.name,
p.anyothercolumns,
n.idnumber,
n.anyothercolumns
FROM People p
JOIN IDNumbers n ON p.idnumber = n.idnumber
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply