# Get list of topics pinned globally

**URL:** <https://meta.discourse.org/t/get-list-of-topics-pinned-globally/68972>\
**Category:** Data & reporting\
**Tags:** sql-query\
**Created:** [August 29, 2017, 7:41am UTC](https://meta.discourse.org/t/get-list-of-topics-pinned-globally/68972 "2017-08-29T07:41:55Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)\
**Post date:** [January 20, 2022, 10:08am UTC](https://meta.discourse.org/t/get-list-of-topics-pinned-globally/68972/8 "2022-01-20T10:08:34Z")

</div>

Here is an updated [Data Explorer](https://meta.discourse.org/t/32566?silent=true) query which returns a tidier list of all pinned posts by category, with globally pinned topics at the top:

```plaintext
SELECT pinned_globally, TO_CHAR(pinned_until,'DD/MM/YYYY') as pinned_till, id as topic_id, user_id, category_id 
FROM topics 
WHERE deleted_at IS NULL
AND pinned_at IS NOT NULL
AND (pinned_until IS NULL OR pinned_until > CURRENT_TIMESTAMP)
ORDER BY pinned_globally desc, category_id

```

---

_[View the full topic](https://meta.discourse.org/t/get-list-of-topics-pinned-globally/68972)._
