Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

Simple join in postgresql [closed]

$
0
0

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 ?


Viewing all articles
Browse latest Browse all 1138

Latest Images

Trending Articles



Latest Images