Re: LEAST and GREATEST functions? - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: LEAST and GREATEST functions?
Date
Msg-id 20030701202207.GA4463@wolff.to
Whole thread Raw
In response to Re: LEAST and GREATEST functions?  (Greg Stark <gsstark@mit.edu>)
List pgsql-sql
On Tue, Jul 01, 2003 at 12:29:16 -0400, Greg Stark <gsstark@mit.edu> wrote:
> 
> SELECT greatest(a,b) FROM bar
> 
> would return one tuple for every record in the table with a single value
> representing the greater of bar.a and bar.b.

You can do this with case.

SELECT CASE WHEN a >= b THEN a ELSE b END FROM bar;


pgsql-sql by date:

Previous
From: Matthew Hixson
Date:
Subject: Re: need some help with a delete statement
Next
From: "scott.marlowe"
Date:
Subject: Re: need some help with a delete statement