Query with Date field = Null

  • I have the following query, which works unless the ExpirationDate filed contains "Null". How would I make it work with Null Values? I'd like it to work where the ExpirationDate is <= or Null.

    SELECT

    tblDataPermit.ApplicationNumber

    ,tblDataPermit.PermitNumber

    ,tblDataPermit.ExpirationDate

    ,tblDataPermit.Type

    ,tblDataPermit.Status

    ,tblDataPermit.ApplicationType

    ,tblDataParcel.StreetName

    ,tblDataParcel.StreetNum

    ,tblDataParcel.Location

    FROM

    tblDataPermit

    INNER JOIN tblDataParcel

    ON tblDataPermit.ParcelID = tblDataParcel.ParcelID

    WHERE

    tblDataPermit.Type = @Type

    AND tblDataPermit.Status = @status

    AND tblDataPermit.ExpirationDate <= @ExpirationDate

  • A simple OR Statement will suffice.

    AND (tblDataPermit.ExpirationDate <= @ExpirationDate

    OR tblDataPermit.ExpirationDate IS NULL);

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • I tried a variant of that but I did not have the () in the right places. Thank you, you're the best!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply