User Tools

Site Tools


adv_sample_user_queries_plus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
adv_sample_user_queries_plus [2021/05/15 14:18]
daniel index optimisation
adv_sample_user_queries_plus [2021/05/15 14:21]
daniel
Line 1: Line 1:
-==== Advanced examples of SQL queries ====+ ==== Advanced examples of SQL queries ====
  
 === Messages sent, with senders or recipients from a specific domain, but not tagged with a specified tag: === === Messages sent, with senders or recipients from a specific domain, but not tagged with a specified tag: ===
Line 34: Line 34:
 </​code>​ </​code>​
 ---- ----
 +
 +=== Messages from the thread with the most unprocessed messages ===
 +<code sql>
 +select mail_id from mail where thread_id in
 +(select thread_id
 +  from mail
 +   where status&​32=0 and status&​16=0
 +     and thread_id is not null
 +   group by thread_id
 +   order by count(*) desc
 +   limit 1
 +)
 +</​code>​
  
 See the [[http://​www.manitou-mail.org/​doc/​mdx/​database-schema.html|database schema documentation]] for definitions of tables and columns. See the [[http://​www.manitou-mail.org/​doc/​mdx/​database-schema.html|database schema documentation]] for definitions of tables and columns.
  
adv_sample_user_queries_plus.txt ยท Last modified: 2021/05/15 14:21 by daniel