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