# MySQL WHERE pointing to custom property..?

**URL:** <https://forum.inductiveautomation.com/t/mysql-where-pointing-to-custom-property/7457>\
**Category:** Ignition\
**Created:** [October 23, 2013, 8:10pm UTC](https://forum.inductiveautomation.com/t/mysql-where-pointing-to-custom-property/7457 "2013-10-23T20:10:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcorkern](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rcorkern](https://forum.inductiveautomation.com/u/rcorkern)\
**Post date:** [October 23, 2013, 8:10pm UTC](https://forum.inductiveautomation.com/t/mysql-where-pointing-to-custom-property/7457/1 "2013-10-23T20:10:34Z")

</div>

I have the following update query:

system.db.runUpdateQuery(“UPDATE test\_history SET productserial\_name = ‘%s’ WHERE test\_ID = event.source.parent.test\_ID” % (serial), ‘Customer’)

The WHERE is looking at the INT of custom property (event.source.parent.test\_ID) which is a query pulling the last test\_ID field in the table. I’ve tried brackets, quotes, and all others but it’s not liking the syntax…Using this same syntax, I can put a number in and it updates the right test\_ID for that row…what’s the proper syntax of a ‘WHERE’ clause to look at a custom property value?

Thank you in advance! 🙂

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [October 23, 2013, 8:24pm UTC](https://forum.inductiveautomation.com/t/mysql-where-pointing-to-custom-property/7457/2 "2013-10-23T20:24:27Z")

</div>

Hi, you should do it like this:

```auto
system.db.runPrepUpdate("UPDATE test_history SET productserial_name=? WHERE test_ID=?", [serial,event.source.parent.test_ID], "Customer")
```

Nick

---

<div class="post-metadata">

**Author:** ![rcorkern](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rcorkern](https://forum.inductiveautomation.com/u/rcorkern)\
**Post date:** [October 23, 2013, 9:44pm UTC](https://forum.inductiveautomation.com/t/mysql-where-pointing-to-custom-property/7457/3 "2013-10-23T21:44:41Z")

</div>

AWESOME! Thanks Nick
