Created
August 15, 2008 21:57
-
-
Save loe/5662 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT content_items.id id, 'ContentItem' AS class, 7 AS class_id, CAST(GROUP_CONCAT(DISTINCT comments.body SEPARATOR ' ') AS CHAR) AS comments, UNIX_TIMESTAMP(content_items.created_at) AS created_at, CONCAT_WS(' ', content_items.description, content_items.filename) AS description, content_items.title AS title, UNIX_TIMESTAMP(content_items.updated_at) AS updated_at FROM content_items JOIN (comments, discussions) ON (content_items.id = discussions.target_id AND discussions.target_type = 'ContentItem' AND comments.discussion_id = discussions.id) GROUP BY content_items.id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment