Answers.Body: <p>I'm not sure if you can do this in the same query but you can use two queries, one for each range, and then merge them, something like this:</p>
  
  <pre><code>{% set range1 = craft.entries({myFieldHandle: ['and', '&gt; 0', '&lt; 10']}) %}
  {% set range2 = craft.entries({myFieldHandle: ['and', '&gt; 20', '&lt; 30']}) %}
  {% set entries = range1 |merge(range2) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-01T01:32:15.697Z
Answers.Text: This is an excellent way to do it. You should query for the `ids`, and then merge those, and then query by id.
Answers.UserDisplayName: Marion Newlevant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-31T22:44:53.380Z
Answers.LastActivityDate: 2018-01-31T22:44:53.380Z
Answers.UserDisplayName: Mato
Body: <p>I currently have this working for a single range of numbers, but I can’t figure it out for multiple ranges. I currently have it set up like this for one range, and it works. <code>myFieldHandle: ['and', '&gt; 0', '&lt; 10']</code>.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-31T15:04:32.353Z
Comments.Text: Providing some of your code will help others more easily answer your question.
Comments.UserDisplayName: Dan Zuzevich
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-31T22:51:47.537Z
Comments.Text: Possible duplicate of [Complex logic on a ElementCriteriaModel parameter?](https://craftcms.stackexchange.com/questions/1948/complex-logic-on-a-elementcriteriamodel-parameter)
Comments.UserDisplayName: carlcs
Tags: <elementcriteriamodel>
Title: Search for entries where a field value is between multiple ranges of numbers
ThreadText: # Search for entries where a field value is between multiple ranges of numbers
  
  (Asked by: username_0 on 2018-01-31)
  
  I currently have this working for a single range of numbers, but I can’t figure it out for multiple ranges. I currently have it set up like this for one range, and it works. `myFieldHandle: ['and', '> 0', '< 10']`.
  
  **Tags:** elementcriteriamodel
  
  > **Comments:**
  > **username_1**: Providing some of your code will help others more easily answer your question.  
  > **username_2**: Possible duplicate of [Complex logic on a ElementCriteriaModel parameter?](https://craftcms.stackexchange.com/questions/1948/complex-logic-on-a-elementcriteriamodel-parameter)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2018-01-31. Score: 3
  
  I'm not sure if you can do this in the same query but you can use two queries, one for each range, and then merge them, something like this:
  
  ```
  {% set range1 = craft.entries({myFieldHandle: ['and', '> 0', '< 10']}) %}
  {% set range2 = craft.entries({myFieldHandle: ['and', '> 20', '< 30']}) %}
  {% set entries = range1 |merge(range2) %}
  
  ```
  
  > **Comments:**
  > **username_4**: This is an excellent way to do it. You should query for the `ids`, and then merge those, and then query by id.  
  
  ---
  
  