join - SQL Subquery: Filter entries that return no rows -
i'm struggling on sql-query... have 3 tables:
1) jobs
2) paper1
3) paper2
paper1 , paper2 have colum job_id corresponding job-id referenced; job id 123 has paper1.job_id of 123.
now want see jobs have corresponding paper1 no paper2 (thus: unfinished, since paper1 , paper2 requirements job fulfilled). attempt this, didn't work out correctly:
select id    jobs   (select id paper1 (job_id = jobs.id) != 0 limit 1)  ,    (select id paper2 (job_id = jobs.id)  = null limit 1)   any appreciated; thanks.
try:
select job_id  paper1  job_id not in (select job_id paper2 group paper2)  group job_id;      
Comments
Post a Comment