User Tools

Site Tools



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

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
adv_sample_user_queries_plus [2014/08/04 13:14]
adv_sample_user_queries_plus [2014/08/31 01:23]
Line 14: Line 14:
 </​code>​ </​code>​
 +=== Latest outgoing message per distinct recipient (to which a message was ever addressed): ===
 +<code sql>
 +select mail_id from (select distinct on (m1.addr_id) m.mail_id,​m1.addr_id
 + from mail_addresses m1 join mail m using(mail_id)
 +  where m1.addr_type=2 and m.status&​129=129
 +  order by m1.addr_id,​m.msg_date desc) s
 ---- ----
adv_sample_user_queries_plus.txt ยท Last modified: 2016/03/13 23:24 by daniel