• SELECT first_appointment.*, next_appointment.*

    FROM (

    SELECT customer#, MIN(appoinment_date) AS appointment_date

    FROM table_name

    GROUP BY customer#

    HAVING MIN(appointment_date) >= '20140101' AND MIN(appointment_date) < '20140901'

    ) AS first_appointment

    CROSS APPLY (

    SELECT TOP (1) next.*

    FROM table_name next

    WHERE next.customer# = first_appointment.customer# AND

    next.appointment_date > DATEADD(DAY, DATEDIFF(DAY, 0, first_appointment.appointment_date) + 30, 0)

    ORDER BY next.appointment

    ) AS next_appointment

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".