Sorry I messed up the first query, here is the corrected version SELECT a.* FROM tablea a WHERE a.iPKID NOT IN (SELECT b.iTableALinkID FROM tableb b) ...
--- In [email protected], "venussoftop" <venussoftop@...> wrote: > > Hi all > > I have tables that can allow me to filter data like this: > SELECT a.* > FROM tablea a > WHERE a.iTableBLinkID NOT IN (SELECT b.iPKID FROM tableb b) > ... > these tables will grow over the years with more and more records cancelling > each other out, so there really will be only few tens of records which do not > have a corresponding iTableBLinkID records at any given point of time > > Or should I introduce a flag in tablea, something like iClosed SMALLINT which > is default zero but set to 1 programatically so the same result could be got > like > SELECT a.* > FROM tablea a > WHERE a.iClosed = 0 > ... > > Which is more efficient from SQL point of view? > > Please advise > > Thanks and regards > Bhavbhuti >
