# Less than or equal to query

**URL:** <https://discuss.aerospike.com/t/less-than-or-equal-to-query/3318>\
**Category:** Query & Indexing\
**Created:** [August 24, 2016, 3:13am UTC](https://discuss.aerospike.com/t/less-than-or-equal-to-query/3318 "2016-08-24T03:13:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mehul](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mehul](https://discuss.aerospike.com/u/mehul)\
**Post date:** [August 24, 2016, 3:13am UTC](https://discuss.aerospike.com/t/less-than-or-equal-to-query/3318/1 "2016-08-24T03:13:15Z")

</div>

I have a set with following values

AcctMin AcctMax MaxWithdrawalLimit 1001 1999 1000 2000 2999 2000

There is another set in which I have stored customer account number.

I would like to get AcctMin and AcctMax for a given customer account number.

Select AcctMin, AcctMax from ReferenceSet where AcctMin \<= CustomerAcctNum AND AcctMax \>= CustomerAcctNum.

I am using C client library. Do I need to use UDF ? I noticed that only as\_int\_equals or as\_range options are available but for a given customer account number AcctMin and AcctMax are unknown.

---

<div class="post-metadata">

**Author:** ![Balu\_nitw](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@Balu\_nitw](https://discuss.aerospike.com/u/Balu_nitw)\
**Post date:** [August 19, 2017, 4:43pm UTC](https://discuss.aerospike.com/t/less-than-or-equal-to-query/3318/2 "2017-08-19T16:43:10Z")

</div>

Hi ,

Can anyone answer to this question. I am stuck at the same problem. And also, can I know if there is a limiting of records on select like normal SQL.

---

<div class="post-metadata">

**Author:** ![pgupta](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/pgupta/32/2351_2.png) [@pgupta](https://discuss.aerospike.com/u/pgupta)\
**Post date:** [August 19, 2017, 6:24pm UTC](https://discuss.aerospike.com/t/less-than-or-equal-to-query/3318/3 "2017-08-19T18:24:51Z")

</div>

See [How to use Aggregation?](https://discuss.aerospike.com/t/how-to-use-aggregation/3653) for ideas. This problem is same as finding if my ip address falls withing a range of ip addresses and easily solved using udfs.
