• Other than mis-placed commas, reserved words as table names, the where clause 'problem' is solved by putting the expression in the where. General hint, don't use column names as alias names for an expression, you'll end up with a situation where you're not sure if SQL's using the column or the alias

    DECLARE @Start DATETIME

    DECLARE @End DATETIME

    SET @Start = DATEADD(dd, -3, GETDATE())

    SET @End = GETDATE()

    SELECT a.ordernuber ,

    b.product ,

    CASE WHEN o.loadate >= p.loaddate THEN o.loaddate

    ELSE p.loaddate

    END AS ComputedLoadDate

    FROM [order] o

    INNER JOIN product p ON o.itemid = p.itemid

    WHERE CASE WHEN o.loadate >= p.loaddate THEN o.loaddate

    ELSE p.loaddate

    END BETWEEN @Start AND @END

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass