XF 2.2 SQL command to get number of attachments (PDF) in one node?

sbj

Well-known member
Hey,

I want to know how many PDFs are saved in one single node. Is there a SQL command I can run to get the number?
 
Solution
SQL:
SELECT COUNT(xf_attachment.attachment_id)
FROM xf_attachment
  INNER JOIN xf_attachment_data ON xf_attachment.data_id = xf_attachment_data.data_id
  INNER JOIN xf_post ON xf_post.post_id = xf_attachment.content_id AND xf_attachment.content_type = 'post'
  INNER JOIN xf_thread ON xf_post.thread_id = xf_thread.thread_id

WHERE xf_thread.node_id IN(70) AND LOWER(xf_attachment_data.filename) LIKE '%.pdf';

Where 70 - your node id.

Kruzya

Well-known member
SQL:
SELECT COUNT(xf_attachment.attachment_id)
FROM xf_attachment
  INNER JOIN xf_attachment_data ON xf_attachment.data_id = xf_attachment_data.data_id
  INNER JOIN xf_post ON xf_post.post_id = xf_attachment.content_id AND xf_attachment.content_type = 'post'
  INNER JOIN xf_thread ON xf_post.thread_id = xf_thread.thread_id

WHERE xf_thread.node_id IN(70) AND LOWER(xf_attachment_data.filename) LIKE '%.pdf';

Where 70 - your node id.
 
Solution
Top