# NamedQuery WHERE multiple values

**URL:** <https://forum.inductiveautomation.com/t/namedquery-where-multiple-values/73896>\
**Category:** Ignition\
**Tags:** ignition81, perspective, database\
**Created:** [May 18, 2023, 1:29pm UTC](https://forum.inductiveautomation.com/t/namedquery-where-multiple-values/73896 "2023-05-18T13:29:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [May 18, 2023, 1:29pm UTC](https://forum.inductiveautomation.com/t/namedquery-where-multiple-values/73896/1 "2023-05-18T13:29:22Z")

</div>

I'm trying to look up records by a column, but matching on multiple values.

The user enters a value that is bound to parameter1 that queryA selects records that match. Then queryB selects from another table where records match the values from one of the columns of queryA.

But that could have none or many values.

How would I accomplish a query that selected where it matched any of the values?

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [May 18, 2023, 1:36pm UTC](https://forum.inductiveautomation.com/t/namedquery-where-multiple-values/73896/2 "2023-05-18T13:36:16Z")

</div>

If you can run both queries at once, I would just use the [WHERE IN](https://www.w3schools.com/sql/sql_in.asp) operator with a nested query.

```auto
QueryB
WHERE col IN (QueryA);

```

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [May 18, 2023, 1:37pm UTC](https://forum.inductiveautomation.com/t/namedquery-where-multiple-values/73896/3 "2023-05-18T13:37:19Z")

</div>

I can. Let me try that out, thanks!

---

<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:** [May 18, 2023, 2:01pm UTC](https://forum.inductiveautomation.com/t/namedquery-where-multiple-values/73896/4 "2023-05-18T14:01:37Z")

</div>

> [@djs](#):
>
> use the [WHERE IN](https://www.w3schools.com/sql/sql_in.asp) operator

Also consider using an INNER JOIN. Many DB's will run those faster than any other multi-table operation.
