I have a simple join query below :
select jobs.location_id
from companies,
jobs
where jobs.company_id = companies.id
and companies.name = 'name';
it doesn’t seem to get the job location of company has that name, but somehow all location_id in jobs table.
Meanwhile these two separate queries do the job:
select id from companies where name = 'name';
select jobs.location_id from jobs where jobs.company_id = [resulted id from query above];
What’s wrong with the first query ?