sql - Update one from two of duplicates in Firebird – more rows -
how update 1 2 or more duplicate rows? want keep 1 , update others new value.
simple example tables:
from
one|two|three ---------- 1|milk|water 1|milk|water
to
one|two|three ---------- 1|milk|water 1|milk|sugar
http://www.ibexpert.net/ibe/index.php?n=doc.themysteryofrdbdbkey
select *, rdb$db_key myexampletable;
then
update myexampletable set column=value rdb$db_key=xxxxx;
another approach using stored procedure (or execute block) , use sql cursor variables. require careful loop management, skip 1 row , change 2nd, third , on.
also see examples update ... current of ...
@ https://www.firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-dml-update.html#fblangref25-dml-tbl-update
but proper way add unique primary key column table , use unique numeric id
Comments
Post a Comment