# InfluxQL query for following example

**URL:** <https://community.influxdata.com/t/influxql-query-for-following-example/12755>\
**Category:** Systems\
**Tags:** influxdb, influxdata, influxql, query\
**Created:** [January 24, 2020, 11:58am UTC](https://community.influxdata.com/t/influxql-query-for-following-example/12755 "2020-01-24T11:58:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shubham\_Patni](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/shubham_patni/32/4054_2.png) [@Shubham\_Patni](https://community.influxdata.com/u/Shubham_Patni)\
**Post date:** [January 24, 2020, 11:58am UTC](https://community.influxdata.com/t/influxql-query-for-following-example/12755/1 "2020-01-24T11:58:16Z")

</div>

I am new to influxdb, was facing problem with following example. Any help would be really grateful.  
Thanks in advance !

input feed :  
time machineid prediction\_field

* * *

1577046001 4-01 0  
1577046002 4-01 0  
1577046003 4-01 0  
1577046004 4-01 0  
1577046005 4-01 0  
1577046006 4-01 0  
1577046007 4-01 0  
1577046008 4-01 1  
1577046009 4-01 1  
1577046010 4-01 1  
1577046011 4-01 1  
1577046012 4-01 1  
1577046013 4-01 0  
1577046014 4-01 0  
1577046015 4-01 0  
1577046016 4-01 0  
1577046017 4-01 1  
1577046018 4-01 1  
1577046019 4-01 1  
1577046020 4-01 0  
1577046021 4-01 0  
1577046022 4-01 0  
1577046023 4-01 0  
1577046024 4-01 0  
1577046025 4-01 0  
1577046026 4-01 1  
1577046027 4-01 1  
1577046028 4-01 1  
1577046029 4-01 1  
1577046030 4-01 1

continous 5 or 5+ 0’s represents downtime  
less than 5 0’s and 1 represents uptime

Calculate downtime for above example.  
Query should return downtime as 13 sec
