# SQL: Error binding needs "double"

**URL:** <https://forum.inductiveautomation.com/t/sql-error-binding-needs-double/54544>\
**Category:** Ignition\
**Created:** [December 30, 2021, 3:19pm UTC](https://forum.inductiveautomation.com/t/sql-error-binding-needs-double/54544 "2021-12-30T15:19:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Fuglsby](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@Nicholas\_Fuglsby](https://forum.inductiveautomation.com/u/Nicholas_Fuglsby)\
**Post date:** [December 30, 2021, 3:19pm UTC](https://forum.inductiveautomation.com/t/sql-error-binding-needs-double/54544/1 "2021-12-30T15:19:50Z")

</div>

I am having a tag quality Error\_DatabaseQuery.

It is giving value however it is in red because of quality.

Exception: Conversion error: query returned null, binding needs “double”  
on query binding for “Main Window.Root Container.Numeric Label 6.value”

Ignition v8.0.15 (b2020072213)  
Java: Azul Systems, Inc. 11.0.6

This is my SQL:  
SELECT  
avg((M1Kw+  
M2Kw+  
M3Kw+  
M4Kw+  
M5Kw+M6kw))\*24 as “kWh”  
FROM  
plant\_power  
Where  
Date(t\_stamp - interval 5 hour) = Date(date\_sub(current\_timestamp, interval 1 day))  
How do i get this not to be red. I tried resetting the SQL and nothing. Please help.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 30, 2021, 3:40pm UTC](https://forum.inductiveautomation.com/t/sql-error-binding-needs-double/54544/2 "2021-12-30T15:40:46Z")

</div>

Try testing the query in the [Database Query Browser](https://docs.inductiveautomation.com/display/DOC81/Database+Query+Browser) and see what error messages it generates. I suspect that the _Interval_ function may not be supported by Ignition as it is MS SQL specific (I think). You might need to use something more generic like _DATEADD()_.

Tip: can you edit your post, select the SQL code and hit the `</>` code formatting button?
