X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 18CF8D8DD1 for ; Wed, 19 Oct 2005 02:41:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31619-08 for ; Wed, 19 Oct 2005 05:41:37 +0000 (GMT) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [151.155.5.143]) by svr1.postgresql.org (Postfix) with ESMTP id 00545D8B94 for ; Wed, 19 Oct 2005 02:41:37 -0300 (ADT) Received: from [172.16.1.100] grzm [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.6 $ on Linux via secured & encrypted transport (TLS); Tue, 18 Oct 2005 23:41:29 -0600 In-Reply-To: <00b101c5d46e$3cd6fa60$6f0aa8c0@codecindia.com> References: <000c01c5ce34$61797c20$6f0aa8c0@codecindia.com> <00b101c5d46e$3cd6fa60$6f0aa8c0@codecindia.com> Mime-Version: 1.0 (Apple Message framework v734) X-Priority: 3 Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <8FB39706-1EFC-4D9F-ADBD-1311D4B08940@myrealbox.com> Cc: postgresql sql list Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: Problem -Postgre sql Date: Wed, 19 Oct 2005 14:41:25 +0900 To: "Vikas J" X-Mailer: Apple Mail (2.734) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.069 required=5 tests=[AWL=-0.763, RCVD_IN_BL_SPAMCOP_NET=1.832] X-Spam-Level: * X-Archive-Number: 200510/209 X-Sequence-Number: 23062 [Please do not email me directly. Please post to the list so others may help and benefit from the discussion.] On Oct 19, 2005, at 14:30 , Vikas J wrote: > IsNull in sql server has syntax like isnull(column,substitute) > if "column" is null it shows value of "substitute". That can be > achieved > with CASE clause in postrgre but I want alternate function. If you look at the doc links I provided below, you will find that COALESCE does exactly this. > Can you tell me how to write function like MAX() that will work > directly on > colmuns. I want to create my own function that will not need table > name as > paramter. > it shld work similarly to max() function in postgre. [Again, it's PostgreSQL or Postgres. It is *not* spelled "postgre".] In my experience, the max() aggregate function does not require table names as parameters and work on columns directly. http://www.postgresql.org/docs/8.0/interactive/functions-aggregate.html I suggest you take some time to look at the docs. They're quite extensive and helpful. http://www.postgresql.org/docs/8.0/interactive/index.html Michael Glaesemann grzm myrealbox com >> I'm not quite sure what the ISNULL() function does in SQL Server, but >> it sounds like it might be similar to either COALESCE or the IS NULL >> expression. >> >> These pages might help you: >> >> COALESCE >> http://www.postgresql.org/docs/8.0/interactive/functions- >> conditional.html#AEN12056 >> >> IS NULL >> http://www.postgresql.org/docs/8.0/interactive/functions- >> comparison.html