Received: from jupiter.netdepot.com (jupiter.netdepot.com [209.51.128.10]) by hub.org (8.9.3/8.9.3) with ESMTP id OAA14782 for ; Tue, 22 Jun 1999 14:23:03 -0400 (EDT) (envelope-from devavejay@preveho.com) Received: from webserv.preveho.com (root@www.preveho.com [209.51.131.20]) by jupiter.netdepot.com (8.8.8/8.8.8) with ESMTP id OAA10259 for ; Tue, 22 Jun 1999 14:23:03 -0400 (EDT) (envelope-from devavejay@preveho.com) Received: from jupiter (funk.preveho.com [209.51.132.42]) by webserv.preveho.com (8.9.1/8.9.1) with SMTP id OAA27063 for ; Tue, 22 Jun 1999 14:29:10 -0400 Message-ID: <006801bebcdb$af11ed80$0201a8c0@jupiter.netdepot.com> Reply-To: "Deva Vejay" From: "Deva Vejay" To: Subject: Max () of an empty table... I need it to return 0 any ideas? Date: Tue, 22 Jun 1999 14:18:51 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0065_01BEBCBA.26FCE740" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 This is a multi-part message in MIME format. ------=_NextPart_000_0065_01BEBCBA.26FCE740 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I was looking thru the postgresql message archive searching for a = solution to my problem... which you articulated quit well... if you have = max(key) of an empty table, the result set is { } which when added to = anything gives you { }=20 =20 do you know how make the result of max(key) of a empty table return 0 we = have tried writing our oun c funtion : int newmax (int arg,int arg2) { if (arg2=3D=3D0) { return (arg2); } else { return(arg); } } =20 =20 we call it : =20 select newmax(max({key}), Count({key})) which returns us { } if we call it w/ select newmax(3,0)) returns 0 if we call it w/ select newmax(12,4)) returns 4 =20 it does not work on an empty table :( =20 please help... =20 =20 -Deva Vejay devavejay@preveho.com ------=_NextPart_000_0065_01BEBCBA.26FCE740 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I was looking thru the postgresql = message=20 archive searching for a solution to my problem... which you articulated = quit=20 well... if you have max(key) of an empty table, the result set is = {  =20 } which when added to anything gives you {    } =
 
do you know how make the result of max(key) of a = empty table=20 return 0 we have tried writing our oun c funtion :
 
 
int
newmax (int arg,int arg2) = {
  if=20 (arg2=3D=3D0)
  {
        = return=20 (arg2);
  }
  else
 =20 {
        return(arg);
 =20 }
}
 
 
we call it :
 
select newmax(max({key}), = Count({key})) which=20 returns us {     }
if we call it w/   select newmax(3,0))  returns 0
if we = call it=20 w/   select newmax(12,4))  = returns=20 4
 
it does not work on an empty table = :(
 
please help...
 
 
-Deva Vejay
devavejay@preveho.com
------=_NextPart_000_0065_01BEBCBA.26FCE740--