Skip to main content
added 14 characters in body
Source Link
Mark J. Reeves
  • 2.7k
  • 13
  • 24

Updated: The solution I first posted (below) was for the unique entries that match 1 parent entry. This query should pull all unique entries for your channel:

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select distinct t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id in (Select entry_id from exp_channel_titles where channel_id = 1)"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

Replace channel_id=1 with your channel's ID. Or use:

Select distinct t.title related_title, t.url_title related_url_title
                        from exp_relationships r join exp_channel_titles t
                        on r.rel_child_id = t.entry_id
                        where rel_parent_id in (Select entry_id from exp_channel_titles tt join exp_channel w
                        on tt.channel_id = w.channel_id where w.channel_name = 'activity')

Hopefully that works. The only site I have handy that uses native relationships is a 1.6.x site and the table/field names are different, so I'm writing the queries one way and then fixing them.

As was suggested in another answer, Playa offers many more options for this sort of thing, and conversion instructions.

First posting, that pulled related entries for 1 entry.

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id = {entry_id}"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

The exp_relationships table is pretty straightforward.

Updated: The solution I posted was for the unique entries that match 1 parent entry. This query should pull all unique entries for your channel:

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select distinct t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id in (Select entry_id from exp_channel_titles where channel_id = 1)"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

Replace channel_id=1 with your channel's ID. Or use:

Select distinct t.title related_title, t.url_title related_url_title
                        from exp_relationships r join exp_channel_titles t
                        on r.rel_child_id = t.entry_id
                        where rel_parent_id in (Select entry_id from exp_channel_titles tt join exp_channel w
                        on tt.channel_id = w.channel_id where w.channel_name = 'activity')

Hopefully that works. The only site I have handy that uses native relationships is a 1.6.x site and the table/field names are different, so I'm writing the queries one way and then fixing them.

As was suggested in another answer, Playa offers many more options for this sort of thing, and conversion instructions.

First posting, that pulled related entries for 1 entry.

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id = {entry_id}"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

The exp_relationships table is pretty straightforward.

Updated: The solution I first posted (below) was for the unique entries that match 1 parent entry. This query should pull all unique entries for your channel:

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select distinct t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id in (Select entry_id from exp_channel_titles where channel_id = 1)"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

Replace channel_id=1 with your channel's ID. Or use:

Select distinct t.title related_title, t.url_title related_url_title
                        from exp_relationships r join exp_channel_titles t
                        on r.rel_child_id = t.entry_id
                        where rel_parent_id in (Select entry_id from exp_channel_titles tt join exp_channel w
                        on tt.channel_id = w.channel_id where w.channel_name = 'activity')

Hopefully that works. The only site I have handy that uses native relationships is a 1.6.x site and the table/field names are different, so I'm writing the queries one way and then fixing them.

As was suggested in another answer, Playa offers many more options for this sort of thing, and conversion instructions.

First posting, that pulled related entries for 1 entry.

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id = {entry_id}"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

The exp_relationships table is pretty straightforward.

added 89 characters in body
Source Link
Mark J. Reeves
  • 2.7k
  • 13
  • 24

Updated: The solution I posted was for the unique entries that match 1 parent entry. This query should pull all unique entries for your channel:

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select distinct t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id in (Select entry_id from exp_channel_titles where channel_id = 1)"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

Replace channel_id=1 with your channel's ID. Or use:

Select distinct t.title related_title, t.url_title related_url_title
                        from exp_relationships r join exp_channel_titles t
                        on r.rel_child_id = t.entry_id
                        where rel_parent_id in (Select entry_id from exp_channel_titles tt join exp_channel w
                        on tt.channel_id = w.channel_id where w.channel_name = 'activity')

Hopefully that works. The only site I have handy that uses native relationships is a 1.6.x site and the table/field names are different, so I'm writing the queries one way and then fixing them.

As was suggested in another answer, Playa offers many more options for this sort of thing, and conversion instructions.

First posting, that pulled related entries for 1 entry.

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id = {entry_id}"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

The exp_relationships table is pretty straightforward.

Updated: The solution I posted was for the unique entries that match 1 parent entry. This query should pull all unique entries for your channel:

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select distinct t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id in (Select entry_id from exp_channel_titles where channel_id = 1)"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

Replace channel_id=1 with your channel's ID. Or use:

Select distinct t.title related_title, t.url_title related_url_title
                        from exp_relationships r join exp_channel_titles t
                        on r.rel_child_id = t.entry_id
                        where rel_parent_id in (Select entry_id from exp_channel_titles tt join exp_channel w
                        on tt.channel_id = w.channel_id where w.channel_name = 'activity')

Hopefully that works. The only site I have handy that uses native relationships is a 1.6.x site and the table/field names are different, so I'm writing the queries one way and then fixing them.

As was suggested in another answer, Playa offers many more options for this sort of thing.

First posting, that pulled related entries for 1 entry.

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id = {entry_id}"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

The exp_relationships table is pretty straightforward.

Updated: The solution I posted was for the unique entries that match 1 parent entry. This query should pull all unique entries for your channel:

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select distinct t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id in (Select entry_id from exp_channel_titles where channel_id = 1)"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

Replace channel_id=1 with your channel's ID. Or use:

Select distinct t.title related_title, t.url_title related_url_title
                        from exp_relationships r join exp_channel_titles t
                        on r.rel_child_id = t.entry_id
                        where rel_parent_id in (Select entry_id from exp_channel_titles tt join exp_channel w
                        on tt.channel_id = w.channel_id where w.channel_name = 'activity')

Hopefully that works. The only site I have handy that uses native relationships is a 1.6.x site and the table/field names are different, so I'm writing the queries one way and then fixing them.

As was suggested in another answer, Playa offers many more options for this sort of thing, and conversion instructions.

First posting, that pulled related entries for 1 entry.

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id = {entry_id}"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

The exp_relationships table is pretty straightforward.

added 1496 characters in body
Source Link
Mark J. Reeves
  • 2.7k
  • 13
  • 24

Updated: The solution I believe this will doposted was for the trickunique entries that match 1 parent entry. This query should pull all unique entries for your channel:

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select distinct t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id in (Select entry_id from exp_channel_titles where channel_id = 1)"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

Replace channel_id=1 with your channel's ID. Or use:

Select distinct t.title related_title, t.url_title related_url_title
                        from exp_relationships r join exp_channel_titles t
                        on r.rel_child_id = t.entry_id
                        where rel_parent_id in (Select entry_id from exp_channel_titles tt join exp_channel w
                        on tt.channel_id = w.channel_id where w.channel_name = 'activity')

Hopefully that works. The only site I have handy that uses native relationships is a 1.6.x site and the table/field names are different, so I'm writing the queries one way and then fixing them.

As was suggested in another answer, Playa offers many more options for this sort of thing.

First posting, that pulled related entries for 1 entry.

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id = {entry_id}"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

The exp_relationships table is pretty straightforward.

I believe this will do the trick:

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id = {entry_id}"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

The exp_relationships table is pretty straightforward.

Updated: The solution I posted was for the unique entries that match 1 parent entry. This query should pull all unique entries for your channel:

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select distinct t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id in (Select entry_id from exp_channel_titles where channel_id = 1)"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

Replace channel_id=1 with your channel's ID. Or use:

Select distinct t.title related_title, t.url_title related_url_title
                        from exp_relationships r join exp_channel_titles t
                        on r.rel_child_id = t.entry_id
                        where rel_parent_id in (Select entry_id from exp_channel_titles tt join exp_channel w
                        on tt.channel_id = w.channel_id where w.channel_name = 'activity')

Hopefully that works. The only site I have handy that uses native relationships is a 1.6.x site and the table/field names are different, so I'm writing the queries one way and then fixing them.

As was suggested in another answer, Playa offers many more options for this sort of thing.

First posting, that pulled related entries for 1 entry.

<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id = {entry_id}"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

The exp_relationships table is pretty straightforward.

Source Link
Mark J. Reeves
  • 2.7k
  • 13
  • 24
Loading