# 回复邮件的最佳实践

**URL:** <https://meta.discourse.org/t/best-practices-on-reply-by-email/96107>\
**Category:** Community Building\
**Tags:** data-explorer\
**Created:** [2018年八月31日 16:27 UTC](https://meta.discourse.org/t/best-practices-on-reply-by-email/96107 "2018-08-31T16:27:50Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [2018年八月31日 22:14 UTC](https://meta.discourse.org/t/best-practices-on-reply-by-email/96107/10 "2018-08-31T22:14:52Z")

</div>

> [@omarfilip](#):
>
> A query to find the count and percentage of all posts made by email versus in the browser?

Per user:

```
select 
  username, 
  sum(case when (posts.via_email='t') then 100 else 0 end)/count(posts.id) as perc_by_mail, 
  sum(case when (posts.via_email='t') then 1 else 0 end) cnt_by_mail,
  sum(case when (posts.via_email<> 't') then 100 else 0 end)/count(posts.id) as perc_not_by_mail, 
  sum(case when (posts.via_email<> 't') then 1 else 0 end) cnt_not_by_mail
from posts
left join users on users.id = posts.user_id
where posts.created_at >= now() - interval '4 weeks'
group by username

```

All:

```
select 
  sum(case when (posts.via_email='t') then 100 else 0 end)/count(posts.id) as perc_by_mail, 
  sum(case when (posts.via_email='t') then 1 else 0 end) cnt_by_mail,
  sum(case when (posts.via_email<> 't') then 100 else 0 end)/count(posts.id) as perc_not_by_mail, 
  sum(case when (posts.via_email<> 't') then 1 else 0 end) cnt_not_by_mail
from posts
left join users on users.id = posts.user_id
where posts.created_at >= now() - interval '4 weeks'

```

---

_[View the full topic](https://meta.discourse.org/t/best-practices-on-reply-by-email/96107)._
