Do you have a calendar / date table? If so, then you can use the date table to help you get the minimum price for the product for each date in periods in the table.
After that, you can get the start and end dates of each of the periods by looking at the next and previous records with the same product identifier. You can use the LAG and LEAD functions for this. This gives you the outer boundaries of each of your desired groups.
From there, it just messes around a bit to get the final result. I have given the example below, which should give you the desired results.
--Get the best price per date for each product WITH BestPricePerDate AS ( SELECT Id, MIN(Price) Price, c.[Date] FROM [YourTable] yt INNER JOIN dbo.Calendar c ON c.[Date] BETWEEN yt.StartDate AND yt.EndDate GROUP BY Id, [Date] ), --Check whether the date is the start or the end of a period PeriodsMarkedPerId AS( SELECT Id, Price, [Date], CASE WHEN ISNULL(LAG(Price,1) OVER (PARTITION BY Id ORDER BY [Date]),-1) <> Price OR ISNULL(LAG([Date],1) OVER (PARTITION BY Id ORDER BY [Date]),'1999-01-01') <> DATEADD(DAY,-1,[Date]) THEN 1 ELSE 0 END IsStartDate, CASE WHEN ISNULL(LEAD(Price,1) OVER (PARTITION BY Id ORDER BY [Date]),-1) <> Price OR ISNULL(LEAD([Date],1) OVER (PARTITION BY Id ORDER BY [Date]),'1999-01-01') <> DATEADD(DAY,1,[Date]) THEN 1 ELSE 0 END IsEndDate FROM BestPricePerDate ), --Keep only the start and end date records PeriodStartAndEndDates AS( SELECT Id, Price, [Date], IsStartDate, IsEndDate FROM PeriodsMarkedPerId WHERE IsStartDate = 1 OR IsEndDate = 1 ), --Move StartDate and EndDate to one record StartAndEndDatesOnSameRow AS( SELECT Id, Price, [Date] AS StartDate, LEAD([Date],1) OVER (ORDER BY Id, [Date]) AS EndDate, IsStartDate FROM PeriodStartAndEndDates ) --Get the resulting periods SELECT Id, Price, StartDate, EndDate FROM StartAndEndDatesOnSameRow WHERE IsStartDate = 1 ORDER BY Id, StartDate
If you do not have a date table, you can easily create one. There are many examples of this on the Internet.
Hope this helps!