Remove 'not in' claus from subqueries
I have following query
select *
from object
where parent_id = ?
and id not in ( select parent_id
from object
where discriminator='ABC')
I have tried to use Joins as follows
select *
from object parent
inner join object child
on (parent.id != child.parent_id)
where child.discriminator='ABC'
But I am getting incorrect result. Is there any way to improve the
performance of query in postgres.
No comments:
Post a Comment