Select Distinct Order By Array_Position

Поиск
Список
Период
Сортировка
От Mark Williams
Тема Select Distinct Order By Array_Position
Дата
Msg-id 004301d485bc$00347250$009d56f0$@gmail.com
обсуждение исходный текст
Ответы Re: Select Distinct Order By Array_Position  (Rob Sargent <robjsargent@gmail.com>)
Re: Select Distinct Order By Array_Position  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-sql

Hi,

 

I am getting an error “SELECT DISTINCT, ORDER BY expressions must appear in select list”. I am ordering by documents.id and it appears in my select list. So I am guessing the problem lies with the array. Is there any way of achieving this? Query is below.

 

SELECT DISTINCT documents.id, page_no FROM texts LEFT JOIN documents on documents.id=texts.doc_id WHERE doc_id IN (26194, 2345, 189) AND  (text LIKE '%RIVER%') ORDER BY array_position(ARRAY[26194, 2345, 189]::INTEGER[], documents.id)

 

Thanks,

 

Mark

__

 

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

Предыдущее
От: "Voillequin, Jean-Marc"
Дата:
Сообщение: Weird "could not determine which collation to use for stringcomparison" with LEAST/GREATEST on PG11 procedure
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: Select Distinct Order By Array_Position