How can I query for a sequence of values in a table
just 9 joins
if ID is indexed the join will be efficient
if you have gaps in ID that needs to be compressed then this does not work  

select row1.* 
from table row1 
join table row2 
      on row2.id = row1.id + 1
     and row1.value = 0 
     and row2.value = 0
join table row3 
      on row3.id = row1.id + 2
     and row3.value = 0 
join table row4 
      on row4.id = row1.id + 3
     and row4.value = 0 
...
join table row10
      on row10.id = row1.id + 9
     and row10.value = 0 


if no negative values  

 select row1.id
   from table row1 
   join table row2 
         on row2.id &gt;= row1.id 
        and row2.id &lt;= row1.id + 10 
  group by row1.id 
 having sum(row2.value) = 0