sql_basic_stats
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | sql_basic_stats [2015/11/18 04:58] (current) – created daniel | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Number of messages for a given month ====== | ||
| + | (including days with no message). | ||
| + | Example for July, 2015 | ||
| + | <code postgresql> | ||
| + | |||
| + | SELECT day::date, coalesce(cnt, | ||
| + | | ||
| + | from mail | ||
| + | where msg_date> | ||
| + | and msg_date<' | ||
| + | -- and other optional conditions | ||
| + | group by 1 | ||
| + | ) as list | ||
| + | RIGHT JOIN | ||
| + | | ||
| + | ' | ||
| + | interval '1 day') as d(day) | ||
| + | USING (day) | ||
| + | ORDER BY 1 | ||
| + | </ | ||
| + | |||
sql_basic_stats.txt · Last modified: 2015/11/18 04:58 by daniel
