<p>It's not possible to do both an "and" and an "or" in a single query going though the ElementCriteriaModel.</p>

<p>Here are a few other posts that go into more detail and provide some potential workarounds.</p>

<p><a href="https://craftcms.stackexchange.com/questions/4560/how-can-i-create-an-elementcriteriamodel-with-and-and-or">How can I create an ElementCriteriaModel with &#39;and&#39; and &#39;or&#39;</a></p>

<p><a href="https://craftcms.stackexchange.com/questions/587/how-to-fetch-specific-users-or-admins-with-the-elementcriteriamodel">How to fetch specific users OR admins with the ElementCriteriaModel?</a></p>

CC BY-SA 3.0
2017-01-04T21:23:26.753Z
2017-01-04T21:23:26.753Z
Brad Bell
<p>I am trying to filter entries based on multiple field value ranges.
For example: All entries where my <code>customField (type: number) is between 0 and 10 OR 20 and 25</code>.</p>

<p>It's straightforward to filter by one range:</p>

<pre><code>{% set results = craft.entries({
  customField: ['and', '&gt;= 0', '&lt; 10']
}) %}
</code></pre>

<p>How would I add multiple ranges for the same field to the above query?</p>

<entries><filter>
Filter entries by multiple field ranges
# Filter entries by multiple field ranges

(Asked by: username_0 on 2017-01-02)

I am trying to filter entries based on multiple field value ranges.
For example: All entries where my customField (type: number) is between 0 and 10 OR 20 and 25.
It's straightforward to filter by one range:
{% set results = craft.entries({
  customField: ['and', '>= 0', '< 10']
}) %}

How would I add multiple ranges for the same field to the above query?

**Tags:** entries, filter

---

## 1 answers

### Answer by username_1 on 2017-01-04. Score: 1

It's not possible to do both an "and" and an "or" in a single query going though the ElementCriteriaModel.

Here are a few other posts that go into more detail and provide some potential workarounds.

[How can I create an ElementCriteriaModel with 'and' and 'or'](https://craftcms.stackexchange.com/questions/4560/how-can-i-create-an-elementcriteriamodel-with-and-and-or)

[How to fetch specific users OR admins with the ElementCriteriaModel?](https://craftcms.stackexchange.com/questions/587/how-to-fetch-specific-users-or-admins-with-the-elementcriteriamodel)


---

