sql_analysis
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
sql_analysis [2016/10/04 16:17] – [Duplicate messages] daniel | sql_analysis [2019/01/24 17:55] (current) – [Presence and count of specific mail headers] daniel | ||
---|---|---|---|
Line 52: | Line 52: | ||
<code sql> | <code sql> | ||
select FIELD||':' | select FIELD||':' | ||
- | from (select FIELD, regexp_matches(lines, | + | from (select FIELD, regexp_matches(lines, |
from header, | from header, | ||
| | ||
Line 80: | Line 80: | ||
The '' | The '' | ||
to the simple equality operator, for which '' | to the simple equality operator, for which '' | ||
- | ====== | + | |
- | To retrieve all messages containing pdf files or any image file: | + | ====== |
+ | |||
+ | Output a list of tags sorted by hierarchy level and names, | ||
+ | with an indentation to represent the hierarchy. | ||
<code sql> | <code sql> | ||
- | select | + | WITH RECURSIVE tagr(a, |
- | </ | + | select |
+ | array[row_number() over (order by name)] as a, | ||
+ | tag_id, | ||
+ | name, | ||
+ | 1 as level | ||
+ | from tags where parent_id is null | ||
+ | UNION ALL | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | FROM tags JOIN tagr ON tagr._tag_id=tags.parent_id | ||
+ | ) | ||
+ | select repeat(' | ||
- | ====== Messages sent or received today ====== | ||
- | < | ||
- | select mail_id from mail where msg_date> | ||
</ | </ | ||
sql_analysis.1475597874.txt.gz · Last modified: 2016/10/04 16:17 by daniel