• Ouch. I saw the other post first (which has some good replies), and replied there. Anyway, the title of the other post suggest that the poster wants the query to return rows with NULLs in that date column.

    Duplicating my reply from there, here's a stripped down version:

    CREATE TABLE po

    (ID int not null, location int, poDate date)

    INSERT po (ID, location, poDate)

    VALUES (2, 24, '2014-07-08'),

    (2, 24, null)

    DECLARE @poID int = 2;

    -- Existing logic

    SELECT * FROM po WHERE id = @poID AND location = 24 AND

    poDate = (SELECT MAX(ISNULL (poDate, '1900-01-01')) FROM po WHERE id = @poID)

    -- Proposed logic

    SELECT * FROM po WHERE id = @poID AND location = 24 AND

    (poDate IS NULL OR poDate = ISNULL((SELECT MAX (poDate) FROM po WHERE id = @poID), '1900-01-01'))