Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id BB7AE632C81 for ; Wed, 14 Apr 2010 01:33:52 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 64304-01 for ; Wed, 14 Apr 2010 04:33:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.26]) by mail.postgresql.org (Postfix) with ESMTP id 1239C632C00 for ; Wed, 14 Apr 2010 01:33:41 -0300 (ADT) Received: by qw-out-2122.google.com with SMTP id 8so2627730qwh.61 for ; Tue, 13 Apr 2010 21:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :content-type:content-transfer-encoding:mime-version:subject:date :x-mailer; bh=F1OV8gKjXv28Lc9K/CVOyD9LbuslCqizzu6ouxsLE4I=; b=IaYy/URKS8IyO7o9gSc75JLfVXv5xpdhaz3lUGzENjHKMl/qs2iTkdu370FMKeQP1g vlIGR5FjoXCgxAq9GqgKRF0S67XxabT+IcjOVlfM2aGX35GsYigvxWeV92KzHoeZX1vQ NPa7tqD/pFp7auB0hFl6wTvXDbm13fUppgih0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer; b=Yn0XHLfPyv9Bg9TWqahz58PzLAy33UEG5k/4ps53aCqisxb2UYHXs34nOv0dEeLY5Z CTp9ypC1e4hkNOL40Mx3ZknPBzaHWi0bA+53LQSjr22IfZLyT4khjA4biTIhysvDS296 OcyvJkcKhEHdHJPSuYhiHCb+JjcZ+YPInvnxY= Received: by 10.229.186.211 with SMTP id ct19mr2684187qcb.16.1271219620852; Tue, 13 Apr 2010 21:33:40 -0700 (PDT) Received: from [192.168.0.7] ([222.66.64.50]) by mx.google.com with ESMTPS id v26sm8443858qce.13.2010.04.13.21.33.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 13 Apr 2010 21:33:39 -0700 (PDT) Message-Id: <2A8BBCA2-814C-4E8D-BCE1-11FA2F8D120E@gmail.com> From: Feixiong Li To: pgsql-sql@postgresql.org Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: How to max() make null as biggest value? Date: Wed, 14 Apr 2010 12:33:30 +0800 X-Mailer: Apple Mail (2.936) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201004/64 X-Sequence-Number: 33991 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@gmail.com