setup sql to pull prior week messages
This commit is contained in:
parent
90cc2ba2b6
commit
c2a313dc64
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#$PG -t -A -c "SELECT '## 2023-03-31' UNION ALL SELECT ' - ' ||(message->>'text') from rlarp.thirtysec where mdate >= '2023-03-31'" | fold -s -w 80 | sed -E 's/^([^ -])/ \1/;s/^(-{1,2} )/ \1/;s/^/ /'
|
#$PG -t -A -c "SELECT '## 2023-03-31' UNION ALL SELECT ' - ' ||(message->>'text') from rlarp.thirtysec where mdate >= '2023-03-31'" | fold -s -w 80 | sed -E 's/^([^ -])/ \1/;s/^(-{1,2} )/ \1/;s/^/ /'
|
||||||
|
|
||||||
$PG -t -A -c "SELECT '## 2023-04-06' UNION ALL SELECT '- ' ||mdate||' [[]] '||(message->>'text') from rlarp.thirtysec where mdate >= '2023-04-06'" >> /mnt/c/Users/PTrowbridge/hc_notes/30sec.md
|
$PG -t -A -f last_week.pg.sql >> /mnt/c/Users/PTrowbridge/hc_notes/30sec.md
|
||||||
|
8
last_week.pg.sql
Normal file
8
last_week.pg.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
SELECT
|
||||||
|
'## '||(SELECT (SELECT MAX(mdate) FROM rlarp.thirtysec)::date - ((EXTRACT(DOW FROM (SELECT MAX(mdate) FROM rlarp.thirtysec)::date) - 5 + 7) % 7) * INTERVAL '1 day' AS last_friday)
|
||||||
|
UNION ALL
|
||||||
|
SELECT '- ' ||mdate||' [[]] '||(message->>'text')
|
||||||
|
FROM
|
||||||
|
rlarp.thirtysec
|
||||||
|
WHERE
|
||||||
|
mdate >= (SELECT (SELECT MAX(mdate) FROM rlarp.thirtysec)::date - ((EXTRACT(DOW FROM (SELECT MAX(mdate) FROM rlarp.thirtysec)::date) - 5 + 7) % 7) * INTERVAL '1 day' AS last_friday)
|
Loading…
Reference in New Issue
Block a user