<p>You would do such things by first getting the entries IDs and then do a query to get all entries with these IDs:</p>

<pre><code>{% set entryIdsA = craft.entries.section('SectionA').ids() %}
{% set entryIdsB = craft.entries.section('SectionB').relatedTo('CategoryC').ids() %}

{% set allEntryIds = entryIdsA|merge(entryIdsB) %}

{% set allEntries = craft.entries.id(allEntryIds).order('mySortByField desc') %}
</code></pre>

CC BY-SA 3.0
2014-12-05T02:59:39.597Z
Thank you @carlcs, the merge filter is all sort of awesome.
SethG
CC BY-SA 3.0
2014-12-04T22:29:17.700Z
2014-12-04T22:29:17.700Z
carlcs
<p>I am looking to do the following.</p>

<p>I'd like to display a list of entries from two sections. That much is straightforward; however the kicker is that I only want entries related to a specific category of one of the sections.</p>

<p>So:</p>

<ul>
<li>Everything from SectionA</li>
<li>Only CategoryC from SectionB</li>
</ul>

<p>Possible?</p>

<entries><relations><sections>
Content from two sections but one of which is related to a specific category
# Content from two sections but one of which is related to a specific category

(Asked by: username_0 on 2014-12-04)

I am looking to do the following.

I'd like to display a list of entries from two sections. That much is straightforward; however the kicker is that I only want entries related to a specific category of one of the sections.

So:

* Everything from SectionA
* Only CategoryC from SectionB

Possible?

**Tags:** entries, relations, sections


---

## 1 answers

### Answer by username_1 on 2014-12-04. Score: 1 | Accepted answer

You would do such things by first getting the entries IDs and then do a query to get all entries with these IDs:
{% set entryIdsA = craft.entries.section('SectionA').ids() %}
{% set entryIdsB = craft.entries.section('SectionB').relatedTo('CategoryC').ids() %}

{% set allEntryIds = entryIdsA|merge(entryIdsB) %}

{% set allEntries = craft.entries.id(allEntryIds).order('mySortByField desc') %}

> **Comments:**
> **username_0**: Thank you @username_1, the merge filter is all sort of awesome.  

---

