I have a page that I want to list the entries in a channel, but I ONLY want the entry to be listed IF it has a relationship. So I am populating the filter with the following:
<h4>SHOW BY SERVICE</h4>
<ul>
<li class="segment-1 selected-1 active"><a href="#" class="all">All</a></li>
{exp:channel:entries
channel='service'
orderby='title'
sort='asc'
disable='categories|member_data|pagination'
}
<li class="segment-{count}">
<a href="#" class="{url_title}" style="text-transform: capitalize;">{title}</a>
</li>
{/exp:channel:entries}
</ul>
I don't mind writing a custom query to do it, but I tried this:
SELECT DISTINCT(title) AS parent_title FROM exp_channel_titles WHERE entry_id IN ( SELECT DISTINCT(parent_id) AS parent FROM exp_relationships )
with no luck. Maybe I am over complicating things with this one. The rest of the page is under an entry loop in another channel:
{exp:channel:entries
channel='success_story'
disable='categories|member_data'
orderby='date'
sort='desc'
}
...
The field is in the Success Stories
channel as a relationship field named {services_used}
which is pointing to the Service
channel to relate it to the various services used.
I just need to be able to list the Service
channel entries (distinctly) if they are referenced as used by a Success Story
entry.