'greatest' function?

Поиск
Список
Период
Сортировка
Искать

'greatest' function?

От:
"jws" <jsacksteder@gmail.com>
Дата:
Is there any buil-in function to return the lesser of two numbers?

i.e. lesser(100,125) would return 100.

Do I need to roll my own?

Re: 'greatest' function?

От:
brian <brian@zijn-digital.com>
Дата:
jws wrote:
> Is there any buil-in function to return the lesser of two numbers?
> 
> i.e. lesser(100,125) would return 100.
> 
> Do I need to roll my own?
> 

Which is it--greatest or least?

No matter, TFM has something to say about it:
http://www.postgresql.org/docs/current/static/functions-math.html#FUNCTIONS-MATH-FUNC-TABLE

brian

Re: 'greatest' function?

От:
Bruce Momjian <bruce@momjian.us>
Дата:
brian wrote:
> jws wrote:
> > Is there any buil-in function to return the lesser of two numbers?
> > 
> > i.e. lesser(100,125) would return 100.
> > 
> > Do I need to roll my own?
> > 
> 
> Which is it--greatest or least?
> 
> No matter, TFM has something to say about it:
> http://www.postgresql.org/docs/current/static/functions-math.html#FUNCTIONS-MATH-FUNC-TABLE

Uh, what function in that table helps him --- I don't see it.

-- 
  Bruce Momjian            http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: 'greatest' function?

От:
"Adam Rich" <adam.r@sbcglobal.net>
Дата:

I don't see greatest or least anywhere on that page... But they ARE
here:

http://www.postgresql.org/docs/8.2/interactive/functions-conditional.htm
l#AEN13140



-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of brian
Sent: Wednesday, February 07, 2007 10:07 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] 'greatest' function?


jws wrote:
> Is there any buil-in function to return the lesser of two numbers?
> 
> i.e. lesser(100,125) would return 100.
> 
> Do I need to roll my own?
> 

Which is it--greatest or least?

No matter, TFM has something to say about it:
http://www.postgresql.org/docs/current/static/functions-math.html#FUNCTI
ONS-MATH-FUNC-TABLE

brian

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Re: 'greatest' function?

От:
"jws" <jsacksteder@gmail.com>
Дата:
> Uh, what function in that table helps him --- I don't see it.

I found GREATEST() and LEAST(), which in combination with COALESCE()
returns exactly what I needed. I missed it because I was looking for
numerical functions. Like so many other things in life, in retrospect,
it's completely obvious.

Re: 'greatest' function?

От:
brian <brian@zijn-digital.com>
Дата:
Adam Rich wrote:
> I don't see greatest or least anywhere on that page... But they ARE
> here:
> 
> http://www.postgresql.org/docs/8.2/interactive/functions-conditional.htm
> l#AEN13140
> 
> 

Yes--my bad. Wrong page.
FAQ