<p>Here are your options:</p>
<ol>
<li><a href="https://craftcms.stackexchange.com/questions/14288/how-to-order-by-related-entry-type-field">How to order by related entry type field</a></li>
<li><a href="https://github.com/craftcms/cms/issues/6010" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/6010</a></li>
</ol>
<p>If you use the logic of the 1st variant, then it should come out something like this:</p>
<pre><code>{# Get all aritsts sorted by title #}
{% for artists in arists %}
    {# Get releases only related to looped artist #}
    {% set releases = craft.entries.section('releases').relatedTo(arist) %}
    {% for release in releases %}
        {# Do whatever you want here, it should be sorted #}
        &lt;p&gt;Artist name: {{ artist.title }}&lt;/p&gt;
        &lt;p&gt;Release name: {{ release.name }}&lt;/p&gt;
    {% endfor %}
{% endfor %}
</code></pre>

CC BY-SA 4.0
2022-10-07T21:55:48.857Z
2022-10-07T21:55:48.857Z
RomanAvr
<p>I am getting music album entries with the following code:</p>
<pre><code>   {% set entries = craft.entries()
      .section('releases')
      .orderBy('title ASC')
      .all() %}
</code></pre>
<p>Rather than ordering by the title, I would like to order by the title of the artist.</p>
<p>The artist is a entry field which I render with:</p>
<pre><code>entry.artist.one().title
</code></pre>
<p>How can I order these entries by artist?</p>

<entries><entries-field><sort>
Orderby entry field?
# Orderby entry field?

(Asked by: username_0 on 2022-10-07)

I am getting music album entries with the following code:
   {% set entries = craft.entries()
      .section('releases')
      .orderBy('title ASC')
      .all() %}

Rather than ordering by the title, I would like to order by the title of the artist.
The artist is a entry field which I render with:
entry.artist.one().title

How can I order these entries by artist?

**Tags:** entries, entries-field, sort


---

## 1 answers

### Answer by username_1 on 2022-10-07. Score: 1

Here are your options:

How to order by related entry type field
https://github.com/craftcms/cms/issues/6010

If you use the logic of the 1st variant, then it should come out something like this:
{# Get all aritsts sorted by title #}
{% for artists in arists %}
    {# Get releases only related to looped artist #}
    {% set releases = craft.entries.section('releases').relatedTo(arist) %}
    {% for release in releases %}
        {# Do whatever you want here, it should be sorted #}
        Artist name: {{ artist.title }}
        Release name: {{ release.name }}
    {% endfor %}
{% endfor %}


---

