# How to find solved topics in db

**URL:** https://meta.discourse.org/t/how-to-find-solved-topics-in-db/364149
**Category:** Support
**Tags:** solved, sql-query
**Created:** [April 30, 2025, 1:17pm UTC](https://meta.discourse.org/t/how-to-find-solved-topics-in-db/364149 "2025-04-30T13:17:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![adopilot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adopilot/32/105040_2.png) [@adopilot](https://meta.discourse.org/u/adopilot)
#### Post date: [April 30, 2025, 1:17pm UTC](https://meta.discourse.org/t/how-to-find-solved-topics-in-db/364149/1 "2025-04-30T13:17:13Z")

</div>

Since I update my Discourse to ver 3.5.0.beta3-dev my query for searching solved topics does not work proper anymore.

To find solved topic I usually querying table **topic\_custom\_fields** for column **name** to contains **accepted\_answer\_post\_id**

```plaintext
select 
users.username,count(distinct assignments.topic_id) obaveza
from assignments
inner join users on assignments.assigned_to_id=users.id
inner join topics on assignments.topic_id=topics.id
inner join categories on topics.category_id=categories.id
left outer join topic_custom_fields on topics.id=topic_custom_fields.topic_id and topic_custom_fields.name='accepted_answer_post_id'
where assignments.active=true
and assigned_to_type='User'
and deleted_at is null
and topics.closed=false
and topic_custom_fields.value is null
group by users.username
order by obaveza desc

```

But now looks like table topic\_custom\_fields do not get row with accepted\_answer\_post\_id value.

Where I should look now for solved/unsolved topics ?

Here is my json query

```plaintext
{
    "query": {
        "id": 12,
        "name": "Broj obaveza po krosniuku gurpisano",
        "description": "Ovo je broj obaveza po korisku grupisan",
        "username": "admir",
        "group_ids": [47],
        "last_run_at": "2025-04-30T13:07:43.405Z",
        "user_id": 5,
        "sql": "\r\n\r\nselect \r\nusers.username,count(distinct assignments.topic_id) obaveza\r\nfrom assignments\r\ninner join users on assignments.assigned_to_id=users.id\r\ninner join topics on assignments.topic_id=topics.id\r\ninner join categories on topics.category_id=categories.id\r\nleft outer join topic_custom_fields on topics.id=topic_custom_fields.topic_id and topic_custom_fields.name='accepted_answer_post_id'\r\nwhere assignments.active=true\r\nand assigned_to_type='User'\r\nand deleted_at is null\r\nand topics.closed=false\r\nand topic_custom_fields.value is null\r\ngroup by users.username\r\norder by obaveza desc",
        "param_info": [],
        "created_at": "2023-08-29T13:15:17.015Z",
        "hidden": false
    }
}

```

---

<div class="post-metadata">

### Author: ![adopilot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adopilot/32/105040_2.png) [@adopilot](https://meta.discourse.org/u/adopilot)
#### Post date: [April 30, 2025, 1:27pm UTC](https://meta.discourse.org/t/how-to-find-solved-topics-in-db/364149/3 "2025-04-30T13:27:36Z")

</div>

My apologies for opening topic, I find needed data it inside table **discourse\_solved\_solved\_topics** it is little tricky to browse all 250 tables inside catalog.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [May 30, 2025, 1:27pm UTC](https://meta.discourse.org/t/how-to-find-solved-topics-in-db/364149/4 "2025-05-30T13:27:45Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
