• My apologies. Hopefully this helps:

    --===== If the test table already exists, drop it

    IF OBJECT_ID('TempDB..#invoices','U') IS NOT NULL

    DROP TABLE #invoices

    --===== Create the test table with

    CREATE TABLE #invoices

    (

    InvoiceID INT,

    CustomerID INT,

    Total MONEY

    )

    INSERT INTO #invoices VALUES (3546,95,30)

    INSERT INTO #invoices VALUES (3547,100,12)

    INSERT INTO #invoices VALUES (3548,95,42)

    INSERT INTO #invoices VALUES (3549,100,25)

    INSERT INTO #invoices VALUES (3550,100,30)

    SELECT * FROM #invoices

    Also, to revise my request a bit, I would only need the records returned that at least $10 greater than the previous invoice for that customer. The previous invoice would not need to be shown (unless it too was $10 greater than its previous invoice).

    So the expected result set:

    InvoiceID------CustomerID------Total

    --3549-----------100-------------25.00

    --3548-----------95---------------42.00

    Thank you!