Re: sql questions

Поиск
Список
Период
Сортировка
От hamann.w@t-online.de
Тема Re: sql questions
Дата
Msg-id wolfgang-1180721062307.A0117279@localhost
обсуждение исходный текст
Ответ на Re: sql questions  (Thiemo Kellner <thiemo@gelassene-pferde.biz>)
Список pgsql-general

>> Zitat von hamann.w@t-online.de:
>> 
>> > 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




В списке pgsql-general по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: User documentation vs Official Docs
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: In certain cases, can UPDATE transactions fail rather than block waiting for “FOR UPDATE lock”?