Re: getting min/max of two values

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: rihad <rihad(at)mail(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: getting min/max of two values
Date: 2007-09-15 17:32:43
Message-ID: 1189877563.5924.115.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 2007-09-15 at 12:40 +0500, rihad wrote:
> How can I efficiently return the minimum/maximum of two given
> expressions? Like SELECT MYMIN(a+b-c,d+e*f).
>

SELECT LEAST(a+b-c,d+e*f);
SELECT GREATEST(a+b-c,d+e*f);

Regards,
Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marinos Yannikos 2007-09-15 21:45:41 read-only queries on PITRslaves, any progress?
Previous Message hubert depesz lubaczewski 2007-09-15 16:21:34 Re: text_pattern_ops index *not* used in field = value condition?