Re: Get the max(value1, value2, value3) from a table

Поиск
Список
Период
Сортировка
От Emi Lu
Тема Re: Get the max(value1, value2, value3) from a table
Дата
Msg-id 4782AD66.3060606@encs.concordia.ca
обсуждение исходный текст
Ответ на Re: Get the max(value1, value2, value3) from a table  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Ответы Re: Get the max(value1, value2, value3) from a table  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Список pgsql-sql
>>> select ?max?(col1, col2, col3) as result;
>>> will return
>>>
>>> result
>>> -------
>>> 5
>>> 8
>>> 12
>>>
>>> (3 rows)
>> 8.1 (I believe?) introduced GREATEST(), which does precisely what you're
>> looking for.
> 
> How would greatest give him three rows like that?  Maybe I'm
> misunderstanding what the OP was asking for...

IF 8.1, "select greatest(col1, col2, col3) from test" is exactly what I 
am looking for.

I would do the optional query by union/or for now.

Thanks!
Ly.


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

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Get the max(value1, value2, value3) from a table
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Get the max(value1, value2, value3) from a table