SELECT (topics.id * 5 + 2) AS id, '' AS active_time, '' AS blog_type, boards.name AS board, topics.board_id AS board_id, CAST(GROUP_CONCAT(posts.content SEPARATOR ' ') AS CHAR) AS body, '' AS category, 'Topic' AS class, 2 AS class_id, '' AS comments, '' AS editorial, UNIX_TIMESTAMP(topics.published_at) AS published_at, topics.title AS title, '' AS total_time, CAST(GROUP_CONCAT(posts.user_name SEPARATOR ' ') AS CHAR) AS user FROM topics LEFT OUTER JOIN boards ON boards.id = topics.board_id LEFT OUTER JOIN posts ON topics.id = posts.topic_id WHERE topics.id >= 1 AND topics.id <= 10000 AND topics.state = 0 OR topics.state = 3 AND posts.state = 0 GROUP BY id