>> Zitat von hamann.w@xxxxxxxxxxx: >> >> > a) I am running some select query >> > select ... order by .... >> > Now, I would like to preserver the ordering through further >> > processing by adding a sequence number >> > Of course I can do: >> > create temp sequence mseq; >> > select xx.*, nextval('mseq') as ord from (select ... order by ....) xx; >> > drop sequence mseq; >> > Is there a simpler way (avoiding the create/drop parts) >> >> Can't you just do the ordering at the end of the processing? Maybe you >> need to drag along the order by columns and just dump them at the very >> end if applicable. >> Hi, in this specific case every search result consists of a pair of related entries that are not close to each other in ordering. So I order by first entry and use the row number to keep the second entry next to the first one, BTW: the use case is scanning a database of people for duplicates. Whenever there are 3 or more components in a name, the split betwwen first and last name can be ambiguous, and so its is common to find both "Ludwig" "van Beethoven" and "Ludwig van" "Beethoven" Best regards WOlfgang