Subject RE: [firebird-support] delete and skip
Author Svein Erling Tysvær
I seriously doubt SKIP to be supported within the DELETE clause, I thought SKIP only was part of the SELECT FIRST... in Firebird. I normally solve things like this by using

DELETE FROM foo f
WHERE EXISTS(SELECT * FROM foo f2 WHERE f2.foobar = f.foobar AND f2.PK < f.PK)
AND f.foobar = 'mystuff'

If your table doesn't have a PK, I suppose you could achieve the same thing using RDB$DB_KEY, though my tables virtually always contain a PK so I don't know whether there are potential pitfalls (though a few seconds of searching reveals the page www.firebirdfaq.org/faq301).

Set

-----Original Message-----
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Dalton Calford
Sent: 25. september 2007 20:11
To: firebird-support@yahoogroups.com
Subject: [firebird-support] delete and skip

Is it possible to use skip in delete statements?

for example

delete from foo where foobar='mystuff' skip 1

to delete duplicate records, leaving only one remaining....

I was looking but could not find if firebird 1.53 supported it or not.

thanks in advance

Dalton