Quote:
Originally Posted by Vanquish39
Try 2: When I do this... I get no med names
select med_name
from pharmacy
inner join junction using (pharmacy_id)
inner join item using (item_id);
|
several comments...
first, there is absolutely no point doing any joins if all you want to retrieve is the item names
the SELECT clause should therefore also include the pharmacy name, right? i mean, otherwise the query can just pull from the item table and bob's your uncle
second, stay totally and completely away from USING, even if it's a valid option
third, in any query involving more than one table, you must always qualify every column used throughout the query
you will thank me for that advice later
Code:
SELECT pharmacy.businessName
, item.med_name
FROM pharmacy
INNER
JOIN junction
ON junction.pharmacy_id = pharmacy.pharmacy_id
INNER
JOIN item
ON item.item_id = junction.item_id