Skip to content

Instantly share code, notes, and snippets.

@kernow
Created March 31, 2011 12:40
Show Gist options
  • Save kernow/896286 to your computer and use it in GitHub Desktop.
Save kernow/896286 to your computer and use it in GitHub Desktop.
SELECT
`archive_messages`.`id` AS `id`,
`archive_messages`.`body` AS `body`,
`archive_messages`.`utc` AS `created_at`,
`users`.id AS `user_id`,
`questions`.id AS `question_id`
FROM
archive_collections
INNER JOIN archive_messages
ON archive_collections.id = archive_messages.coll_id
INNER JOIN users
ON users.login_name = SUBSTRING_INDEX(archive_collections.us, '@', 1)
INNER JOIN questions
ON questions.cached_slug = archive_collections.with_user
WHERE
archive_collections.with_server LIKE 'conference.%'
AND SUBSTRING_INDEX(archive_collections.us, '@', 1) = SUBSTRING_INDEX(archive_messages.name, '_____', 1)
AND archive_collections.id = archive_messages.coll_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment