I have follwing data :
Product Price StartDate EndDate
Apples 4.9 2010-03-01 00:00:00.000 2010-03-01 00:00:00.000
Apples 4.9
SELECT product, price, MIN(start_date), MAX(end_date)
FROM (
SELECT product, price, start_date, end_date,
ROW_NUMBER() OVER (PARTITION BY product ORDER BY startDate) rn1,
ROW_NUMBER() OVER (PARTITION BY product, price ORDER BY startDate) rn2
FROM mytable
) q
GROUP BY
product, price, rn2 - rn1
ORDER BY
product, MIN(start_date), price