# Query to find all linked mentions for a page

**URL:** https://community.silverbullet.md/t/query-to-find-all-linked-mentions-for-a-page/617
**Category:** General
**Created:** [July 10, 2024, 3:37pm UTC](https://community.silverbullet.md/t/query-to-find-all-linked-mentions-for-a-page/617 "2024-07-10T15:37:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![shashlick](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/s/977dab/32.png) [@shashlick](https://community.silverbullet.md/u/shashlick)
#### Post date: [July 10, 2024, 3:37pm UTC](https://community.silverbullet.md/t/query-to-find-all-linked-mentions-for-a-page/617/1 "2024-07-10T15:37:06Z")

</div>

I’d like to make a template that shows the contents of all linked mentions for a page.

Basically I need a way to query: page where is\_mentioned in page2

Is this possible?

---

<div class="post-metadata">

### Author: ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)
#### Post date: [July 10, 2024, 5:21pm UTC](https://community.silverbullet.md/t/query-to-find-all-linked-mentions-for-a-page/617/2 "2024-07-10T17:21:26Z")

</div>

If I understand you correctly the Linked Mentions template does exactly this: [Library/Core/Widget/Linked Mentions](https://silverbullet.md/Library/Core/Widget/Linked%20Mentions)

---

<div class="post-metadata">

### Author: ![shashlick](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/s/977dab/32.png) [@shashlick](https://community.silverbullet.md/u/shashlick)
#### Post date: [July 11, 2024, 3:28pm UTC](https://community.silverbullet.md/t/query-to-find-all-linked-mentions-for-a-page/617/3 "2024-07-11T15:28:27Z")

</div>

Duh - that’s obvious in retrospect. Thanks!

Meanwhile, how do you remove repeats in a query? A link to a page shows up multiple times if the page is linked multiple times. Is there a way to return each page only once - group by, distinct or something like that?

---

<div class="post-metadata">

### Author: ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)
#### Post date: [July 11, 2024, 4:48pm UTC](https://community.silverbullet.md/t/query-to-find-all-linked-mentions-for-a-page/617/4 "2024-07-11T16:48:17Z")

</div>

It will do a distinct automatically on all the fields you `select`. So `task select name` will give you of all unique task names, for instance.

---

<div class="post-metadata">

### Author: ![shashlick](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/s/977dab/32.png) [@shashlick](https://community.silverbullet.md/u/shashlick)
#### Post date: [July 11, 2024, 5:20pm UTC](https://community.silverbullet.md/t/query-to-find-all-linked-mentions-for-a-page/617/5 "2024-07-11T17:20:46Z")

</div>

Right but a page can be linked to another multiple times so the following returns the same page multiple times since each link is a distinct link but to the same page.

```auto
link where toPage = @page and page != @page.name order by page desc

```

---

<div class="post-metadata">

### Author: ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)
#### Post date: [July 11, 2024, 5:24pm UTC](https://community.silverbullet.md/t/query-to-find-all-linked-mentions-for-a-page/617/6 "2024-07-11T17:24:55Z")

</div>

Add `select page, toPage` and you will get unique rows.

And be sure to use `toPage = @page.name` there.
