• I think you might want something like this:

    DECLARE @orders TABLE

    (

    OrderNo INT,

    ReceiptDate DATE

    );

    SELECT

    *

    FROM

    @orders AS O

    WHERE

    EXISTS ( SELECT

    1

    FROM

    @orders AS O2

    WHERE

    O2.OrderNo = O.OrderNo

    HAVING

    MAX(O2.ReceiptDate) >= DATEADD(MONTH, -6, CURRENT_TIMESTAMP) );

    I'm not saying there isn't a better way and since you are in the 2014 forum you might be able to do something with the windowing functions.