Subject Re: [ib-support] Delete first 100 from table
Author Don Gollahon
Ok. So it would probably be good to do a query that gets the first 100:

SELECT FIRST 100 YourField FROM YourTable
WHERE <your Condition>

Then, scan thru it using the delete query as the second query. This would
delete one record at a time. Use the key fields from the above query as
parameters for the delete query.

This would be slow, too, I would imagine, since it would be sending the
query 1,000,000 times if there were a million records to delete.



""Arno Brinkman"" <firebird@...> wrote in message
news:<010e01c32f9c$b426c830$0d02a8c0@...>...
Hi,

> I guess you could something like
>
> DELETE FROM YourTable
> WHERE YourField IN
> (
> SELECT FIRST 100 YourField FROM YourTable
> WHERE <your Condition>
> );


Note that this will delete _ALL_ rows if <your condition> contains an equal
comparision between de the sub-query and base-query, because for every
record of YourTable the sub-query is executed.


Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird links :
http://www.firebirdsql.com
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/


Nederlandse firebird nieuwsgroep :
news://80.126.130.81




To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/