merge back to back rows based on start & end date
WITH x AS
(
SELECT
    Zone,
    Status,
    CASE WHEN 
             COALESCE(LAG(Status) 
             OVER (PARTITION BY Zone ORDER BY Zone, [From]), '') &lt;&gt; Status
         THEN 1 ELSE 0 END AS LS,
    [From],
    [To]
FROM
    t
), Y AS
(
SELECT
    Zone,
    Status,
    SUM(LS) OVER (PARTITION BY Zone ORDER BY Zone, [From]) Grp,
    [From],
    [To]
FROM
    x
)
SELECT
    Zone,
    Status,
    MIN([From]) [From],
    MAX([To]) [To]
FROM
    y
GROUP BY
   Zone, Status, Grp
ORDER BY 
   Grp;




Zone | Status | From                | To                 
:--- | :----- | :------------------ | :------------------
z1   | Open   | 01/01/2015 00:00:00 | 10/01/2015 00:00:00
z1   | Closed | 10/01/2015 00:00:00 | 20/01/2015 00:00:00
z1   | Open   | 20/01/2015 00:00:00 | 26/01/2015 00:00:00



db&lt;>fiddle here