<p><code>{% set entries = craft.entries().section('media').orderBy(&quot;(CASE WHEN `title` LIKE 'The %' THEN SUBSTRING(`title`, 5) WHEN `title` LIKE 'A %' THEN SUBSTRING(`title`, 3) ELSE `title` END) asc&quot;).limit(24).all() %}</code>
worked.</p>

CC BY-SA 4.0
2020-07-15T13:57:34.317Z
Really cleaver!
Piotr Pogorzelski
CC BY-SA 4.0
2020-07-15T12:26:59.390Z
2020-07-15T12:26:59.390Z
MarkD
<p>If I have a huge list of TV shows and Movies, many of them have &quot;The&quot; in the title, meaning they all get grouped together if you order by title.</p>
<p>Is it possible to &quot;filter out&quot; a word in entry titles when using orderBy?</p>
<pre><code>{% set entries = craft.entries().section('media').orderby('title asc').limit(24).all() %}
</code></pre>

CC BY-SA 4.0
2020-07-15T09:17:58.450Z
This seems to be answered over here -> https://craftcms.stackexchange.com/a/29996/526
dmatthams
CC BY-SA 4.0
2020-07-15T11:38:29.353Z
Thanks, I'll give that a try.
MarkD
<entry><ordering><filtering>
orderBy title, but remove the word "The" from titles
# orderBy title, but remove the word "The" from titles

(Asked by: username_0 on 2020-07-15)

If I have a huge list of TV shows and Movies, many of them have "The" in the title, meaning they all get grouped together if you order by title.
Is it possible to "filter out" a word in entry titles when using orderBy?
{% set entries = craft.entries().section('media').orderby('title asc').limit(24).all() %}

**Tags:** entry, ordering, filtering
> **Comments:**
> **username_1**: This seems to be answered over here -> https://craftcms.stackexchange.com/a/29996/526  
> **username_0**: Thanks, I'll give that a try.  

---

## 1 answers

### Answer by username_0 on 2020-07-15. Score: 3

`{% set entries = craft.entries().section('media').orderBy("(CASE WHEN `title` LIKE 'The %' THEN SUBSTRING(`title`, 5) WHEN `title` LIKE 'A %' THEN SUBSTRING(`title`, 3) ELSE `title` END) asc").limit(24).all() %}`
worked.

> **Comments:**
> **username_2**: Really cleaver!  

---

