Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-15T13:57:34.317Z
Answers.Text: Really cleaver!
Answers.UserDisplayName: Piotr Pogorzelski
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-15T12:26:59.390Z
Answers.LastActivityDate: 2020-07-15T12:26:59.390Z
Answers.UserDisplayName: MarkD
Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-15T09:17:58.450Z
Comments.Text: This seems to be answered over here -> https://craftcms.stackexchange.com/a/29996/526
Comments.UserDisplayName: dmatthams
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-15T11:38:29.353Z
Comments.Text: Thanks, I'll give that a try.
Comments.UserDisplayName: MarkD
Tags: <entry><ordering><filtering>
Title: orderBy title, but remove the word "The" from titles
ThreadText: # 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!  
  
  ---
  
  