Subject RE: [firebird-support] How can I resolvce this
Author Alan McDonald
> How can I resolvce this
>
>
> Been using in FB.1.5.3 and lower
>
> DELETE FROM TICKETITEMS WHERE TICKET_UNIQUENUM
> NOT IN (SELECT TICKET_UNIQUENUM FROM TICKETS);
>
> it took less than a second
>
> but in FB.2.0.0.0 it never completes.
>
> Thank You
> Hans

Well, a foreign key contraint with a cascade delete would be the way I would
do it. Then you never have to use this sort of query. there would never be
orphans in the first place.
But I suppose you're going to balk at that so we have to offer another way.

This query shouldn't "never complete". I wonder if you have introduced some
other triggers/constraints into the design when moving to FB2?

Try this
> DELETE FROM TICKETITEMS I WHERE I.TICKET_UNIQUENUM
> NOT IN (SELECT T.TICKET_UNIQUENUM FROM TICKETS T);

Alan