# Help - SQL Except Statement - Need an example of How to

**URL:** <https://forum.inductiveautomation.com/t/help-sql-except-statement-need-an-example-of-how-to/6376>\
**Category:** General Discussion\
**Created:** [May 2, 2013, 11:16pm UTC](https://forum.inductiveautomation.com/t/help-sql-except-statement-need-an-example-of-how-to/6376 "2013-05-02T23:16:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsmith](https://avatars.discourse-cdn.com/v4/letter/t/f0a364/32.png) [@tsmith](https://forum.inductiveautomation.com/u/tsmith)\
**Post date:** [May 2, 2013, 11:16pm UTC](https://forum.inductiveautomation.com/t/help-sql-except-statement-need-an-example-of-how-to/6376/1 "2013-05-02T23:16:22Z")

</div>

I want to compare and SQL table to an Ignition Table/Dataset and only list the differences in a new table. I’m trying to bind The SQL statement below to a table, which is intended to only display data that is different. \*Note: I’ve attached an image of the two tables in this post for a visual.

SELECT groups.g\_name FROM groups  
EXCEPT  
SELECT g\_name FROM {Root Container.TableMemberOf.data}  
WHERE {Root Container.TableMemberOf.data.g\_name} = groups.g\_name

I’ve also tried:  
SELECT groups.g\_name FROM groups  
WHERE NOT EXISTS  
(SELECT \* FROM {Root Container.TableMemberOf.data}  
WHERE {Root Container.TableMemberOf.data} = groups.g\_name)

Note: There is only one column on my igntion table that displays or lists the group names. there is no id on the ignition table. Therefore in the script above, I’m using the “groups.group” name from the SQL table and the filter of “\*” on the ignition table, becaust the igntion table has no id.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/49a57151e6c2d46f6314986d83db067f12ea06b7.png)

---

<div class="post-metadata">

**Author:** ![CPowell](https://avatars.discourse-cdn.com/v4/letter/c/a183cd/32.png) [@CPowell](https://forum.inductiveautomation.com/u/CPowell)\
**Post date:** [May 3, 2013, 1:31am UTC](https://forum.inductiveautomation.com/t/help-sql-except-statement-need-an-example-of-how-to/6376/2 "2013-05-03T01:31:20Z")

</div>

You cannot do an SQL query against the table dataset as of Ignition 7.5.6  
However, you could create another table in your database for the items you want to exclude…

Then you should be able to use either example you provided.

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![tsmith](https://avatars.discourse-cdn.com/v4/letter/t/f0a364/32.png) [@tsmith](https://forum.inductiveautomation.com/u/tsmith)\
**Post date:** [May 3, 2013, 3:59pm UTC](https://forum.inductiveautomation.com/t/help-sql-except-statement-need-an-example-of-how-to/6376/3 "2013-05-03T15:59:55Z")

</div>

Copy. I’ll go that route. Thanks for the feedback.
