I currently have 2 tables:
Table Animal:
animal_id, animal_name owner
Table Owners
owner_id owner_name
One way to list all the animals and their respective owners it to use sql joins:
select animal_id, owner_name
from Animals, Owners
where (owner = owner_id);
I'd now like to know how to do the same with subqueries. I thought something like
select animal_id, owner_name
from Animals
where owner_name = (select owner_name from Owners where owner = owner_id)
but that doesn't seem to make the trick. Why?