Jump to content

How can I find topics with the most attachments?


Go to solution Solved by Daniel F,

Recommended Posts

  • Solution
Posted
select id1 as topic_id ,count(*) as total FROM core_attachments_map where location_key = 'forums_Forums'  group by id1 order by total desc

will return the topics with the most attachments

Posted

Why would you want to delete all the content just because of few attachments?:)

Is it really worth to delete some valuable content to get rid of the attachments? I would check the topics manually and probably remove only the attachments!

2. There's no bug in topics with attachment deletion, there's only one affecting Pages records;)

3. Are you worried about the amount of attachments or their size? You could also remove only the really big ones ( you can locate them in your ACP => System => Files ; and sort the table by the size)

  • 10 months later...
Posted
On 4/21/2021 at 8:25 AM, Daniel F said:
select id1 as topic_id ,count(*) as total FROM core_attachments_map where location_key = 'forums_Forums'  group by id1 order by total desc

will return the topics with the most attachments

Hello Daniel,

this query works pretty good but what do I have to add to this query that it only shows results for a specific forum id?

Posted
2 hours ago, Apfelstrudel said:

Hello Daniel,

this query works pretty good but what do I have to add to this query that it only shows results for a specific forum id?

Please note. We cannot assist with custom queries. However you would need to join the topic table, which would then give you the forum ID. Something like this would give you the forum ID so you can then just add a where clause to limit as needed

select a.id1 as topic_id,t.forum_id,count(*) as total FROM core_attachments_map a inner join forums_topics t on t.tid = a.id1 where a.location_key = 'forums_Forums' group by a.id1 order by total desc

 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...