pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
Cc: Gavin Flower <GavinFlower@archidevsys.co.nz>
Cc: pgsql-sql@postgresql.org
Subject: Re: ORDER BY COLUMN_A, (COLUMN_B or COLUMN_C), COLUMN_D
Date: Mon, 17 Sep 2012 12:52:46 +0800
Message-ID: <5056AC9E.4040909@ringerc.id.au> (raw)
In-Reply-To: <505118A7.9020104@gmail.com>
References: <CAGmv+wKCpc9VeyYp6nS9WL1vrtX=3+i87mFVMP4sEpB1LyPGQA@mail.gmail.com>
	<50510E0C.8080704@archidevsys.co.nz>
	<505118A7.9020104@gmail.com>

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




view thread (6+ messages)

Message-ID: <5056AC9E.4040909@ringerc.id.au>
Permalink:  ../5056AC9E.4040909@ringerc.id.au/
Also on:    postgresql.org/message-id/5056AC9E.4040909@ringerc.id.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ringerc@ringerc.id.au, rr.rosas@gmail.com, GavinFlower@archidevsys.co.nz
  Subject: Re: ORDER BY COLUMN_A, (COLUMN_B or COLUMN_C), COLUMN_D
  In-Reply-To: <5056AC9E.4040909@ringerc.id.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox