Re: SELECT MAX question

From: "Len Morgan" <len-morgan(at)crcom(dot)net>
To: "ADBAAMD" <adba(dot)amdocs(at)bell(dot)ca>, "Jacob" <Jay(at)cob(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT MAX question
Date: 2001-04-01 16:51:15
Message-ID: 002d01c0bacb$f8086100$0908a8c0@H233.bstx.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>> I have an sql tatement in my ASP page that has a WHERE date = (SELECT
>> MAX(other_date) FROM SomeTable WHERE Blah1 = Blah2) clause. What's
>> happening is that the query is grabbing the latest date ONLY if something
>> something is in the "other_date" field. If the "other_date" field is
blank,
>> then the record is not chosen. My question is, how do I grab the latest
>> date of "other_date" even if the it happens to be blank?
>
> Adding my own question to this, does pgsql have an equivalent to the
>Oracle NVL function?

You might try adding an additional "OR if Blah1 IS NULL" to your WHERE
clause to pickup the NULL values. This is the way SQL is SUPPOSED to handle
NULL values

len

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 2001-04-01 17:09:05 RE: RE: Re: Dissapearing indexes, what's that all about?
Previous Message Mike Mascari 2001-04-01 16:43:37 RE: SELECT MAX question