<p>You can combine multiple criteria like so:</p>

<pre><code>{% set entries = craft.entries.width('and, &gt;= 100, &lt;= 200') %}
</code></pre>

<p>but what you can't do is to combine multiple statements to build more complex criteria:</p>

<pre><code>{% set entries = craft.entries.width('and, &gt;= 100, &lt;= 200' or '&gt;= 500') %}
</code></pre>

<p>in your case this wouldn't make much sense. But see my still unanswered question on this topic for another example: <a href="https://craftcms.stackexchange.com/q/1948/125">"Complex logic on a ElementCriteriaModel parameter?"</a></p>

CC BY-SA 3.0
2014-10-29T16:50:21.473Z
2014-10-29T16:50:21.473Z
2017-04-13T12:51:00.253Z
carlcs
<p>You can use some basic logic with <code>and</code> or <code>or</code> like this:</p>

<pre><code>craft.entries.width('and, &gt;= 100, &lt;= 200')
</code></pre>

CC BY-SA 3.0
2014-10-29T16:49:47.410Z
2014-10-29T16:49:47.410Z
Douglas McDonald
<p><a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax" rel="nofollow">The Craft site shows an example using a single comparison</a></p>

<p>Building upon this example from that page:</p>

<p><code>craft.entries.width('&gt;= 100')</code></p>

<p>Can I do something similar but where 'width' is ALSO less than or equal to 200?</p>

<p>Conceptually:</p>

<p><code>craft.entries.width('&gt;= 100 &amp;&amp; &lt;= 200')</code></p>

<elementcriteriamodel>
Can I have multiple comparisons within a single criteria parameter?
# Can I have multiple comparisons within a single criteria parameter?

(Asked by: username_0 on 2014-10-29)

[The Craft site shows an example using a single comparison](http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax)

Building upon this example from that page:

`craft.entries.width('>= 100')`

Can I do something similar but where 'width' is ALSO less than or equal to 200?

Conceptually:

`craft.entries.width('>= 100 && <= 200')`

**Tags:** elementcriteriamodel

---

## 2 answers

### Answer by username_1 on 2014-10-29. Score: 3 | Accepted answer

You can combine multiple criteria like so:
{% set entries = craft.entries.width('and, >= 100, <= 200') %}

but what you can't do is to combine multiple statements to build more complex criteria:
{% set entries = craft.entries.width('and, >= 100, <= 200' or '>= 500') %}

in your case this wouldn't make much sense. But see my still unanswered question on this topic for another example: "Complex logic on a ElementCriteriaModel parameter?"


---

### Answer by username_2 on 2014-10-29. Score: 2

You can use some basic logic with and or or like this:
craft.entries.width('and, >= 100, <= 200')


---

