Reputation:
Write a query
to use inner join of
the
Tables
President
and pres_term. The join will be
on
pres_id
in both tables and the query will print only the president’s first and last name,
date of birth,
date of death, start and end dates in office
, and the reason that they left
the office. The joined query will match on president death and term end date
SELECT president.*, pres_term.* FROM president, pres_term INNER JOIN president
ON president.pres_id = pres_term.pres_id WHERE pres_term.term_end_date = president.death;
I can't get this query to work, have been messing with it for hours... I don't know if there is something wrong with the tables or if it's just the query?
Upvotes: 0
Views: 163
Reputation: 17190
Please, modify your query to be like this:
SELECT
president.*,
pres_term.*
FROM
president
INNER JOIN
pres_term ON pres_term.pres_id = president.pres_id
WHERE
pres_term.term_end_date = president.death;
The error you see is because you are referenced president table two times and the "select part" of the query results ambiguous
Upvotes: 1