# Is there an equivalent to SQL IN clause for secondary index?

**URL:** https://discuss.aerospike.com/t/is-there-an-equivalent-to-sql-in-clause-for-secondary-index/2271
**Category:** Query & Indexing
**Tags:** query, secondary
**Created:** [December 17, 2015, 5:24am UTC](https://discuss.aerospike.com/t/is-there-an-equivalent-to-sql-in-clause-for-secondary-index/2271 "2015-12-17T05:24:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![shamik](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/shamik/32/359_2.png) [@shamik](https://discuss.aerospike.com/u/shamik)
#### Post date: [December 17, 2015, 5:24am UTC](https://discuss.aerospike.com/t/is-there-an-equivalent-to-sql-in-clause-for-secondary-index/2271/1 "2015-12-17T05:24:04Z")

</div>

Hi,

I’m trying to see if there’s an equivalent of SQL IN clause while querying on a secondary index. For e.g. I’ve a secondary index on “name” field. Can I construct a query where I can retrieve all records **where name IN (“abc”, “def”, “ghi”, “jkl”)**?

Regards, Shamik

---

<div class="post-metadata">

### Author: ![manigandham](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/manigandham/32/58_2.png) [@manigandham](https://discuss.aerospike.com/u/manigandham)
#### Post date: [December 17, 2015, 6:12am UTC](https://discuss.aerospike.com/t/is-there-an-equivalent-to-sql-in-clause-for-secondary-index/2271/2 "2015-12-17T06:12:08Z")

</div>

Aerospike can do equals for string bins and equals or range for numeric bins but the client drivers do not support multiple filters so you cannot do multiple equals in a single query.

You can do this by writing a Lua UDF. You can pass all the values and the UDF will scan all the records and do the filtering logic you need, like checking multiple bins or multiple values for a single bin.

More info in documentation:

[http://www.aerospike.com/launchpad/query\_multiple\_filters.html](http://www.aerospike.com/launchpad/query_multiple_filters.html)

and other threads:

[https://discuss.aerospike.com/search?q=multiple%20filter](https://discuss.aerospike.com/search?q=multiple%20filter)
