Subject | Re: [firebird-support] How do I return a set containing all records without a entry in the parent table. |
---|---|
Author | Hans |
Post date | 2008-11-28T19:41:18Z |
Replace the 'not in' by 'if not exists (select 1 from ENTRYID where
Entry2.ENTRYID = AssistDetails.ASSISTENTRYID'
will speed this up.
Entry2.ENTRYID = AssistDetails.ASSISTENTRYID'
will speed this up.
>
> I have some sloppy code that allowed for the situation to exist, where a
> parent record could be deleted, without a foreign key cascade delete of
> the child records.
>
> Now I need to find all these records, and delete them manually before I
> can set up the foreign key constraint.
>
> I tried:
> Select AssistDetails.ASSISTENTRYID From AssistDetails
> Where AssistDetails.ASSISTENTRYID Not In(Select Entry2.ENTRYID From
> Entry2)
> but it just hangs indefinitely.
>
>
> Entry2 is the master table, with the Assistdetails the child table.
> I need all AssistEntryID's with no corresponding entries in
> Entry2.EntryID.
>
> Thanks
>
> Adrian
>
> [Non-text portions of this message have been removed]
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>
>