Skip to content

Instantly share code, notes, and snippets.

@und3f
Created August 18, 2011 21:48
Show Gist options
  • Save und3f/1155331 to your computer and use it in GitHub Desktop.
Save und3f/1155331 to your computer and use it in GitHub Desktop.
SELECT
sender.jid || COALESCE('/' || sender_resource, '') AS sender,
recipient.jid || COALESCE('/' || recipient_resource, '') AS recipient,
message.id, message.type, message.body, message.thread
FROM messages message
JOIN identificators sender
ON sender.id = message.sender
JOIN identificators recipient
ON recipient.id = message.recipient
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment