sql_analysis
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
sql_analysis [2011/11/30 12:11] – daniel | sql_analysis [2016/07/21 04:00] – [Presence and count of specific mail headers] daniel | ||
---|---|---|---|
Line 8: | Line 8: | ||
FROM header, (values (' | FROM header, (values (' | ||
WHERE position(E' | WHERE position(E' | ||
- | group by split_part(substr(lines, | + | group by 1 |
</ | </ | ||
Line 48: | Line 48: | ||
| | ||
</ | </ | ||
+ | |||
+ | This alternative implementation uses regular expressions and differs in that it doesn' | ||
+ | <code sql> | ||
+ | select FIELD||':' | ||
+ | from (select FIELD, regexp_matches(lines, | ||
+ | from header, | ||
+ | | ||
+ | | ||
+ | where strpos(lines, | ||
+ | GROUP BY 1 ORDER BY 1 | ||
+ | </ | ||
+ | |||
+ | In this version, the '' | ||
====== Duplicate messages ====== | ====== Duplicate messages ====== | ||
This query finds each message that share the exact same headers than another message with a lower mail_id, which means that it's a duplicate. | This query finds each message that share the exact same headers than another message with a lower mail_id, which means that it's a duplicate. | ||
Line 59: | Line 72: | ||
select distinct mail_id FROM attachments WHERE content_type=' | select distinct mail_id FROM attachments WHERE content_type=' | ||
</ | </ | ||
+ | |||
+ | ====== Messages sent or received today ====== | ||
+ | < | ||
+ | select mail_id from mail where msg_date> | ||
+ | </ | ||
+ | |||
sql_analysis.txt · Last modified: 2019/01/24 17:55 by daniel