# Query to eliminate 0 from data

**URL:** <https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 16, 2025, 8:56pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013 "2025-01-16T20:56:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas\_wallace](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@thomas\_wallace](https://forum.inductiveautomation.com/u/thomas_wallace)\
**Post date:** [January 16, 2025, 8:56pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013/1 "2025-01-16T20:56:11Z")

</div>

```python
SELECT T1HubOilFlowRate.t_stamp,
	T1HubOilFlowRate.T1__FlowRate
WHERE T1_FlowRate > 0
FROM T1HubOilFlowRate
WHERE t_stamp >= :StartDate
	AND t_stamp <= :EndDate
ORDER BY t_stamp

```

I'm trying to eliminate values of 0 from my data. I'm getting an error. Can anyone see what i'm missing?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [January 16, 2025, 8:59pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013/2 "2025-01-16T20:59:57Z")

</div>

You have two `WHERE` statements, combine it into a single `WHERE` after your `FROM` statement using `AND` and `BETWEEN`. Between is inclusive, so it accomplishes the same as  
`WHERE t_stamp >= :StartDate AND t_stamp <= :EndDate`.

```python
WHERE T1__FlowRate > 0 AND
t_stamp BETWEEN :StartDate AND :EndDate

```

Edit: Added missing underscore.

---

<div class="post-metadata">

**Author:** ![thomas\_wallace](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@thomas\_wallace](https://forum.inductiveautomation.com/u/thomas_wallace)\
**Post date:** [January 16, 2025, 9:10pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013/3 "2025-01-16T21:10:09Z")

</div>

@ryan.white I did that but im getting this error now? Not sure how it could be an invalid column name.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/1/c1810fd1b9edd8b22f9bac379a2bb68b5c364ea9.png)

```python
SELECT T1HubOilFlowRate.t_stamp,
	T1HubOilFlowRate.T1__FlowRate
FROM T1HubOilFlowRate
WHERE T1_FlowRate > 0 AND
t_stamp BETWEEN :StartDate AND :EndDate
ORDER BY t_stamp;

```

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [January 16, 2025, 9:12pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013/4 "2025-01-16T21:12:40Z")

</div>

Ah, I quickly glanced at the column name and brain omitted the second `_` in `T1__FlowRate` when making example code.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 16, 2025, 9:13pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013/5 "2025-01-16T21:13:00Z")

</div>

You have a single underscore in one column name, and a double underscore in the other.

Edit: Ryan fixed it faster that I could kibbitz.

---

<div class="post-metadata">

**Author:** ![thomas\_wallace](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@thomas\_wallace](https://forum.inductiveautomation.com/u/thomas_wallace)\
**Post date:** [January 16, 2025, 9:13pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013/6 "2025-01-16T21:13:47Z")

</div>

@pturmel @ryan.white Good catch thank you

---

<div class="post-metadata">

**Author:** ![thomas\_wallace](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@thomas\_wallace](https://forum.inductiveautomation.com/u/thomas_wallace)\
**Post date:** [January 16, 2025, 11:40pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013/7 "2025-01-16T23:40:06Z")

</div>

@pturmel @ryan.white Gathered some data since the change. I'm still getting some 0's in the dataset. The query seems good. Any idea where these can be coming from?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/6/864e369633359ca951dad6d8ef0562284bba5aa9.png)

```python
SELECT T1HubOilFlowRate.t_stamp,
	T1HubOilFlowRate.T1_FlowRate
FROM T1HubOilFlowRate
WHERE T1_FlowRate > 0 AND
t_stamp BETWEEN :StartDate AND :EndDate
ORDER BY t_stamp;

```

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [January 16, 2025, 11:41pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013/8 "2025-01-16T23:41:45Z")

</div>

Some extremely small value that is near zero and being rendered as a 0 because of rounding?

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [January 16, 2025, 11:41pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013/9 "2025-01-16T23:41:55Z")

</div>

Are you sure these are not truncated values?  
Maybe try `WHERE T1_FlowRate > 0.01 AND`

---

<div class="post-metadata">

**Author:** ![thomas\_wallace](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@thomas\_wallace](https://forum.inductiveautomation.com/u/thomas_wallace)\
**Post date:** [January 16, 2025, 11:47pm UTC](https://forum.inductiveautomation.com/t/query-to-eliminate-0-from-data/101013/10 "2025-01-16T23:47:52Z")

</div>

@David_Stone @ryan.white Let me try changing it to \>.01. Thanks.
