Datediff between rows with unsequential ID

  • In that case, it's even simpler.

    SELECT

    id

    ,product

    ,MIN(start_date) AS StartDate

    ,NULL AS EndDate

    FROM @t

    GROUP BY

    id

    ,product

    HAVING COUNT(*) > COUNT(end_date)

    But what happened to the DATEDIFF requirement?

    John

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply