delete from sscontrolfunctions where rowid not in (select min(rowid) from sscontrolfunctions group by id) /
delete from supermag.smdocprops where rowid in (select p1.rowid from supermag.smdocprops p1, supermag.smdocprops p2 where (p1.doctype=p2.doctype and p1.docid=p2.docid and p1.paramname=p2.paramname) and (p1.rowid!=p2.rowid)) /