Re: ORDER BY COLUMN_A, (COLUMN_B or COLUMN_C), COLUMN_D

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: Rodrigo Rosenfeld Rosas <rr(dot)rosas(at)gmail(dot)com>
Cc: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, pgsql-sql(at)postgresql(dot)org
Subject: Re: ORDER BY COLUMN_A, (COLUMN_B or COLUMN_C), COLUMN_D
Date: 2012-09-17 04:52:46
Message-ID: 5056AC9E.4040909@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 09/13/2012 07:20 AM, Rodrigo Rosenfeld Rosas wrote:

> Thank you Gavin, I was looking for this LEAST function for a long time.
> I have tried MIN but it didn't work with strings.

In SQL, "MIN" is an aggregate function. It actually does work with
strings, but only when used as an aggregate:

regress=# SELECT min(x.a) FROM ( VALUES ('blah'),('blah2'),('aaaa') ) x(a);
min
------
aaaa
(1 row)

--
Craig Ringer

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Salomao Domingos 2012-09-17 18:58:51 Disabling constraint check
Previous Message Jasen Betts 2012-09-15 01:54:49 Re: Problem with committing the update