title: Count of consecutive days ORACLE SQL
body: <p>I need help with a query where a need to count de consecutive days like this</p>
  <pre><code>select  
    a.numcad, a.datapu , f.datapu , nvl(to_char(f.datapu, 'DD'),0)dia, 
    
      row_number() over (partition by a.numcad, f.datapu order by f.datapu)particao
  
  from 
   ronda.r066apu a 
           left join (select t.numcad, t.numemp, t.datacc, t.datapu
                        from ronda.r070acc t
                        where t.datacc &gt;= '21/01/2022'
                        and t.datacc &lt;= trunc(sysdate)
                        group by t.numcad, t.numemp, t.datacc, t.datapu)f
            on a.numemp = f.numemp
            and a.numcad = f.numcad
            and a.datapu = f.datapu
   
  where a.numcad = 2675
  and A.DATAPU &gt;= '21/01/2022'
  and A.DATAPU &lt;= trunc(sysdate)
  
  group by a.numcad,  a.datapu, f.datapu, f.datacc
  order by a.datapu
  </code></pre>
  <p>result is</p>
  <p><a href="https://i.stack.imgur.com/45BYm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/45BYm.png" alt="enter image description here" /></a></p>
  <p>between 24/01/2022 and 04/02/2022
  is 12 days i need know this count , but i will ways get the '21/mes/year'</p>