Skip to content

Instantly share code, notes, and snippets.

@bryanjhv
Created April 29, 2021 06:52
Show Gist options
  • Save bryanjhv/f4164993595db92a28c2568338e60ee0 to your computer and use it in GitHub Desktop.
Save bryanjhv/f4164993595db92a28c2568338e60ee0 to your computer and use it in GitHub Desktop.
-- Get SMS summary from Gammu SMSD
-- from almost all content tables.
CREATE VIEW summary
AS
(
SELECT
'inbox' AS kind,
ID AS id,
ReceivingDateTime AS created,
UpdatedInDB AS updated,
SenderNumber AS number,
TextDecoded AS content,
Status AS status
FROM inbox
)
UNION ALL
(
SELECT
'outbox' AS kind,
ID AS id,
SendingDateTime AS created,
UpdatedInDB AS updated,
DestinationNumber AS number,
TextDecoded AS content,
Status AS status
FROM outbox
)
UNION ALL
(
SELECT
'sentitems' AS kind,
ID AS id,
SendingDateTime AS created,
UpdatedInDB AS updated,
DestinationNumber AS number,
TextDecoded AS content,
Status AS status
FROM sentitems
)
ORDER BY
created,
updated
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment