Search Postgresql Archives

Re: getting min/max of two values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007/9/15, rihad <rihad@xxxxxxx>:
> How can I efficiently return the minimum/maximum of two given
> expressions? Like SELECT MYMIN(a+b-c,d+e*f).
>
> Thanks.

Hello

use function GREATEST (maximim) or LEAST (minimum)

http://www.postgresql.org/docs/8.2/interactive/functions-conditional.html#AEN13148

Regards
Pavel Stehule

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux