# Get a value or zero from a SELECT

**URL:** <https://community.grafana.com/t/get-a-value-or-zero-from-a-select/11102>\
**Category:** Time Series Panel\
**Created:** [October 9, 2018, 11:45am UTC](https://community.grafana.com/t/get-a-value-or-zero-from-a-select/11102 "2018-10-09T11:45:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericd](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@ericd](https://community.grafana.com/u/ericd)\
**Post date:** [October 9, 2018, 11:45am UTC](https://community.grafana.com/t/get-a-value-or-zero-from-a-select/11102/1 "2018-10-09T11:45:52Z")

</div>

Hi everyone,

I have a query like `SELECT "papp" FROM "data" WHERE "ptec" = 0 AND $timeFilter` that return me the value of “papp” when “ptec” = 0, it’s ok. But when “ptec” is not 0 (the other value is 1), I want the query to return 0 (or null), so my graph will not draw that serie.  
How can I do that ?

Thanks

---

<div class="post-metadata">

**Author:** ![jangaraj](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/jangaraj/32/39197_2.png) [@jangaraj](https://community.grafana.com/u/jangaraj)\
**Post date:** [October 9, 2018, 5:27pm UTC](https://community.grafana.com/t/get-a-value-or-zero-from-a-select/11102/2 "2018-10-09T17:27:36Z")

</div>

You didn’t mention used TSDB. I guess you are using InfluxDB, where non empty return value for an empty result/match is not possible.

---

<div class="post-metadata">

**Author:** ![ericd](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@ericd](https://community.grafana.com/u/ericd)\
**Post date:** [October 10, 2018, 7:56am UTC](https://community.grafana.com/t/get-a-value-or-zero-from-a-select/11102/3 "2018-10-10T07:56:46Z")

</div>

Yes, InfluxDB… Crying !
