# Solutions for displaying SQL queries on Chart?

**URL:** <https://forum.inductiveautomation.com/t/solutions-for-displaying-sql-queries-on-chart/28846>\
**Category:** Ignition\
**Created:** [October 4, 2019, 8:57pm UTC](https://forum.inductiveautomation.com/t/solutions-for-displaying-sql-queries-on-chart/28846 "2019-10-04T20:57:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [October 4, 2019, 8:57pm UTC](https://forum.inductiveautomation.com/t/solutions-for-displaying-sql-queries-on-chart/28846/1 "2019-10-04T20:57:21Z")

</div>

Ignition 7.9.6

Hey folks,

I’m dealing with some current and historical SQL data that can be unioned (identical tables, one having older timestamps than the other). The queried dataset consists of several numerical columns, a categorical column, and a timestamp. It appears as though this should be supported by the Chart component, but not Easy Chart.

I already have a functioning easy chart (see below), but it only references one of the data tables. Ideally, the chart with the unioned data would display the data similarly to the existing chart.

 ![Easy%20Chart](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/69f394fc74ae206bc7a158d80409f3a11f8ec1ad.png)

So far, I’ve run into roadblocks displaying the categorical “Cool/Heat” properly and along side the numerical data. Can anyone offer any guidance, or refer me to a resource for resolving this?

Cheers,  
Andrew

---

<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:** [October 4, 2019, 10:26pm UTC](https://forum.inductiveautomation.com/t/solutions-for-displaying-sql-queries-on-chart/28846/2 "2019-10-04T22:26:15Z")

</div>

Consider doing the union and any necessary massaging as a view in the database. DB pens in the easy chart can pull from a view as if it is a table.

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [October 4, 2019, 10:42pm UTC](https://forum.inductiveautomation.com/t/solutions-for-displaying-sql-queries-on-chart/28846/3 "2019-10-04T22:42:43Z")

</div>

Thanks, Phil. That’s an idea I had not considered. I have not worked with views much, but it appears as though I could leave this view active and any time it is queried by a user, it will update?

I’ll look into the details and see where I get. Thank you.

---

<div class="post-metadata">

**Author:** ![AIO](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aio/32/87549_2.png) [@AIO](https://forum.inductiveautomation.com/u/AIO)\
**Post date:** [October 4, 2019, 11:08pm UTC](https://forum.inductiveautomation.com/t/solutions-for-displaying-sql-queries-on-chart/28846/4 "2019-10-04T23:08:35Z")

</div>

Thanks again, Phil. That worked flawlessly!
