From f8d299b2872ba432cc42318eab8c83feeb408f46 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sun, 13 Apr 2014 21:04:33 -0700 Subject: [PATCH] Initial version of query showing messages without date field. --- pg/dateless.sql | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 pg/dateless.sql diff --git a/pg/dateless.sql b/pg/dateless.sql new file mode 100644 index 0000000..d321cdb --- /dev/null +++ b/pg/dateless.sql @@ -0,0 +1,31 @@ +/* Select all rows from left table which aren't in right table. + + SELECT l.* + FROM t_left l + LEFT JOIN t_right r + ON r.value = l.value + WHERE r.value IS NULL + */ + +/* + TODO Add another layer of JOINs to show the value where name='Received' for + the missing hashes. Maybe we can parse dates from there. + */ +SELECT + l.hash, r.value +FROM + original l +LEFT JOIN ( + SELECT + hash, + value + FROM + search_header + WHERE + name = 'Date' + ) r +ON + r.hash = l.hash +WHERE + r.hash IS NULL +;