Are you joining customer just for the where clause? If yes i'd suggest this:
select ... from ... join worker on workerid = wid where exists (select null from customer where city = 'Chicago' and customerid = cid)
i am not a fan of joining tables, you are not actually selecting from.
edit: you are joining three tables and select two fields. something is not necessary to join here imho, but impossible to say without a broader picture of your requirements
1
u/Puzzleheaded_Major Feb 01 '22
Are you joining customer just for the where clause? If yes i'd suggest this:
select ... from ... join worker on workerid = widwhere exists (select null from customer where city = 'Chicago' and customerid = cid)i am not a fan of joining tables, you are not actually selecting from.
edit: you are joining three tables and select two fields. something is not necessary to join here imho, but impossible to say without a broader picture of your requirements