# Users who have added tags to topics

**URL:** https://meta.discourse.org/t/users-who-have-added-tags-to-topics/275040
**Category:** Data & reporting
**Tags:** tags, sql-query
**Created:** [11월 18, 2018, 10:00오후 UTC](https://meta.discourse.org/t/users-who-have-added-tags-to-topics/275040 "2018-11-18T22:00:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![southpaw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/southpaw/32/79352_2.png) [@southpaw](https://meta.discourse.org/u/southpaw)
#### Post date: [11월 18, 2018, 10:00오후 UTC](https://meta.discourse.org/t/users-who-have-added-tags-to-topics/275040/1 "2018-11-18T22:00:08Z")

</div>

Could anyone help me get started toward writing a query that would return the users who have added a specific tag to topics, and number of times they’ve done so during a given date range?

@nixie were you able to write that query you described?

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [11월 19, 2018, 3:25오전 UTC](https://meta.discourse.org/t/users-who-have-added-tags-to-topics/275040/2 "2018-11-19T03:25:43Z")

</div>

### Users who have used a specific tag

@southpaw it should return the correct result

```plaintext
-- [params]
-- text :tag_name

SELECT tp.user_id, COUNT(tt.tag_id)
FROM topic_tags tt
INNER JOIN tags t ON t.id = tt.tag_id
INNER JOIN topics tp ON tp.id = tt.topic_id
WHERE t.name = :tag_name
GROUP BY tp.user_id, tt.tag_id

```

---

<div class="post-metadata">

### Author: ![southpaw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/southpaw/32/79352_2.png) [@southpaw](https://meta.discourse.org/u/southpaw)
#### Post date: [11월 19, 2018, 4:36오전 UTC](https://meta.discourse.org/t/users-who-have-added-tags-to-topics/275040/3 "2018-11-19T04:36:26Z")

</div>

Hi @vinothkannans,

Thank you! That appears to return a list of usernames and the number of topics each of those usernames has created that is now tagged “outdated.”

I’m hoping to be able to see **_who is doing the tagging_**. I want to challenge my TL3s to a tagging contest to get some outdated topics cleaned up, but I need to be able to keep a score of who does the most tagging.

We’ve been able to do a similar contest in the past “solving” topics, because marking a topic solved is an action\_type in user\_actions, but I’m not seeing the same kind of data available for adding a tag to a topic.

I was thinking there might be a way to get creative somehow with “last edit” (does tagging count as an edit?) figuring out which user took that action, and maybe matching that timestamp to the “updated” timestamp in topic\_tags… but I’m in over my head. 💫
