Subject | Re: How to delete the output of this "select first 100 seqno from repl_log where relationno =11 order by seqno" |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-06-01T09:32:36Z |
--- In firebird-support@yahoogroups.com, "Mohd. Jeffry" wrote:
execute it for the 50th time records 50 through 149 will be the first
100.
use two statements and an additional table and do
INSERT INTO <newtable>
SELECT FIRST 100 <pk> FROM repl_log
DELETE FROM repl_log
WHERE repl_log.<pk> = (SELECT <newtable>.<pk> FROM <newtable>)
HTH,
Set
> Dear All,Because the subselect is executed once for every row, and when you
>
> How to delete the output of this "select first 100 seqno from
> repl_log where relationno =11 order by seqno"
>
> Doind this:-
>
> "delete from repl_log where exists (select first 100 seqno from
> repl_log where relationno =11 order by seqno) "
>
> seems like deleting the who table instead of 100 records that I
> wanted to delete. Anybody know why?
execute it for the 50th time records 50 through 149 will be the first
100.
> * repl_log is a table. relationno and seqno are fields in repl_logI think a stored procedure is the way to go. Alternatively, you could
> table.
> ** I want to delete the first 100 data with relationno = 11 sorted
> by seqno
use two statements and an additional table and do
INSERT INTO <newtable>
SELECT FIRST 100 <pk> FROM repl_log
DELETE FROM repl_log
WHERE repl_log.<pk> = (SELECT <newtable>.<pk> FROM <newtable>)
HTH,
Set