|Subject||Re: [firebird-support] What is wrong with this delete SQL?|
> Personally, I am not fond of doing stuff with system fields and tablesThere are no system fields or system tables involved here.
It is just a simple delete of duplicate records of a normal table.
Actually I do have a SQL now that does work:
delete from keyword t1
(select 1 from keyword t2
where t1.term_key = t2.term_key and
t1.term_id = t2.term_id and
t1.rdb$db_key < t2.rdb$db_key)
On 8/21/12, Andrea Raimondi <andrea.raimondi@...> wrote:
> On Tue, Aug 21, 2012 at 4:45 PM, Bart Smissaert
> <bart.smissaert@...> wrote:
>> Posted before, but didn't come through as far as I can see.
>> Firebird 1.5, classic on Windows.
>> Have a table with this structure:
>> CREATE TABLE KEYWORD(
>> TERM_KEY CHAR(10) NOT NULL,
>> TERM_ID CHAR(5) NOT NULL)
>> There are non-unique indexes on both fields and there are duplicate
>> Now I am trying to run a SQL to delete duplicate records:
> Personally, I am not fond of doing stuff with system fields and tables.
> If I were you, I'd probably use a stored procedure because you are
> always in control of the SQL and all of its side-effects and it's also
> resilient to engine changes.