July 14, 2005 at 8:32 am
hi
is there a way to get all the rows from 2nd table that are not in 1st table .
so for example there is a parent /child table without the constraint , now we need all the rows in child which dont have a parent
we can try
select * from child where chilId not in (select parentId from parent)
but is there a faster way of doin it for large dataset?
thnks
Amrita
July 14, 2005 at 8:37 am
You can also try
select * from child c
left join parent p on c.childID = p.parentID
where p.parentID is null
and see which is faster.
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.
July 14, 2005 at 8:46 am
Check the not exists too compared to the left join.
July 15, 2005 at 1:43 pm
And make sure you have good indexes, that will greatly improve join performance.
-----
[font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply