Re: Greatest/Least functions?

Поиск
Список
Период
Сортировка
Искать
От
Mike Nolan
Тема
Re: Greatest/Least functions?
Дата
Msg-id
200408221735.i7MHZLWv009715@gw.tssi.com
Ответ на
Список
Дерево обсуждения
Greatest/Least functions? Mike Nolan <nolan@gw.tssi.com>
Re: Greatest/Least functions? Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: Greatest/Least functions? Mike Nolan <nolan@gw.tssi.com>
Re: Greatest/Least functions? Martijn van Oosterhout <kleptog@svana.org>
Why does =ANY(<array>) need an extra cast when used on an array returned by a select? Frank van Vugt <ftm.van.vugt@foxi.nl>
Re: Why does =ANY(<array>) need an extra cast when used Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: Greatest/Least functions? Joe Conway <mail@joeconway.com>
> > As far as I can tell, Postgres has no equivalent to greatest and least
> > functions in Oracle.
> Doesn't max/min() do that ? Note that I know nothing about
> greatest/least in Oracle.

No, max/min are aggregate functions.  Greatest allows you to select
the largest of a series of terms.

Here's a simple example:

greatest(1,2,3,4,5,6) would return 6

Here's a bit more useful one:

greatest(field1,field2,field3) would return the largest value from the 
three supplied fields from the current row.  

Writing a case statement to select the largest from among 3 or more 
values gets a bit complicated.
--
Mike Nolan
В списке pgsql-general по дате отправления
От: Joe Conway
Дата:
Сообщение: Re: Greatest/Least functions?
От: Tom Lane
Дата:
Сообщение: Re: About inheritance
FAQ