All pastes #942865 Raw Edit

Mine

public text v1 · immutable
·published 2008-03-14 20:01 UTC
rendered paste body
SELECT 
	ms.subject AS first_subject, ms.poster_time AS first_poster_time, ms.id_topic, t.id_board, b.name AS bname,
	t.num_replies, t.num_views, ms.id_member AS id_first_member, ml.id_member AS ID_LAST_MEMBER,
	ml.poster_time AS last_poster_time, IFNULL(mems.real_name, ms.poster_name) AS first_poster_name,
	IFNULL(meml.real_name, ml.poster_name) AS lastPosterName, ml.subject AS last_subject,
	ml.icon AS last_icon, ms.icon AS first_icon, t.id_poll, t.is_sticky, t.locked, ml.modified_time AS lastModifiedTime,
	IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from, SUBSTRING(ml.body, 1, 385) AS last_body,
	SUBSTRING(ms.body, 1, 385) AS first_body, ml.smileys_enabled AS last_smileys, ms.smileys_enabled AS first_smileys, t.id_first_msg, t.id_last_msg
FROM main_messages AS ms
	INNER JOIN main_topics AS t ON (t.id_topic = ms.id_topic AND t.id_first_msg = ms.id_msg)
	INNER JOIN main_boards AS b ON (b.id_board = t.id_board)
	INNER JOIN main_messages AS ml ON (ml.id_msg = t.id_last_msg)
	LEFT JOIN main_members AS mems ON (mems.id_member = ms.id_member)
	LEFT JOIN main_members AS meml ON (meml.id_member = ml.id_member)
	LEFT JOIN main_log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = 33743)
	LEFT JOIN main_log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = 33743)
WHERE t.id_board IN (1, 126, 19, 9, 10, 11, 20, 132, 133, 134, 135, 86, 3, 79, 38, 2, 12, 71, 83, 69, 114, 118, 119, 120, 121, 122, 16, 100, 101, 102, 14, 139, 140, 13, 63, 65, 78, 70, 131, 15, 66, 97, 18, 68, 98, 17, 39, 76, 111, 104, 105, 143, 60, 72, 115, 59, 137, 37, 33, 77, 138, 34, 96, 106, 5, 40, 56, 116, 4, 6, 8, 41, 35, 50, 51, 7, 128, 129, 144)
	AND t.id_last_msg >= 1372227
	AND IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) < ml.id_msg
	AND t.approved = 1
ORDER BY t.id_last_msg DESC
LIMIT 0, 25