# Query existing dataset

**URL:** <https://forum.inductiveautomation.com/t/query-existing-dataset/6083>\
**Category:** Ignition\
**Created:** [March 22, 2013, 2:53pm UTC](https://forum.inductiveautomation.com/t/query-existing-dataset/6083 "2013-03-22T14:53:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [March 22, 2013, 2:53pm UTC](https://forum.inductiveautomation.com/t/query-existing-dataset/6083/1 "2013-03-22T14:53:26Z")

</div>

Can someone push me in the direction I should be looking to do this.

I have a screen with 2 tables on it. One doing a general query of data in database table. The second is doing a sum of like products.  
Which creates two hits to database.

Is there a way to use the dataset from table 1 in query for table 2 so there is only one hit to database, kind of like:

SELECT  
xprod#,  
SUM(xqty)  
FROM {Root Container.Table 1.data}  
Group By  
xprod#

---

<div class="post-metadata">

**Author:** ![anna](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@anna](https://forum.inductiveautomation.com/u/anna)\
**Post date:** [March 22, 2013, 6:47pm UTC](https://forum.inductiveautomation.com/t/query-existing-dataset/6083/2 "2013-03-22T18:47:04Z")

</div>

You cannot do an SQL query against the table dataset - but you can search it using the lookup function:[http://www.inductiveautomation.com/support/usermanuals/ignition/index.html?gen\_logic\_lookup.htm](http://www.inductiveautomation.com/support/usermanuals/ignition/index.html?gen_logic_lookup.htm)

---

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [March 25, 2013, 12:33pm UTC](https://forum.inductiveautomation.com/t/query-existing-dataset/6083/3 "2013-03-25T12:33:27Z")

</div>

Ok, Thanks
