How to max() make null as biggest value?

From: Feixiong Li <feixiongli(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to max() make null as biggest value?
Date: 2010-04-14 04:33:30
Message-ID: 2A8BBCA2-814C-4E8D-BCE1-11FA2F8D120E@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi , guys ,

I am newbie for sql, I have a problem when using max() function, I
need get null when there are null in the value list, or return the
largest value as usual, who can do this?

i.e. max([1,2,3,4,5]) => 5
max([1,2,3,4,5,null]) => null

thanks in advance!

Feixiong
feixiongli(at)gmail(dot)com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Gonzalo Aguilar Delgado 2010-04-14 08:23:22 Problem with insert related to different schemas
Previous Message Julio Leyva 2010-04-13 18:01:35 Re: Getting the initdb parameter values