News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Paste-1186028361:v:use_geshi-0:v:type-php

Started by SleePy, Aug 02, 2007, 04:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SleePy

SELECT
   ft.TOPIC_ID AS ID_TOPIC, ft.FORUM_ID AS ID_BOARD, T_SUBJECT AS subject,
   UNIX_TIMESTAMP(REPLACE(ft.T_DATE, '\0', '')) AS TposterTime, T_AUTHOR AS TID_MEMBER,
   T_IP AS TposterIP, IFNULL(ftm.realName, '') AS TposterName,
   REPLACE(REPLACE(T_MESSAGE, '\n', '
'), '\r', '') AS Tbody,
   IFNULL(ftm.emailAddress, '') AS TposterEmail, fte.realName AS TmodifiedName,
   UNIX_TIMESTAMP(REPLACE(ft.T_LAST_EDIT, '\0', '')) AS TmodifiedTime,
   UNIX_TIMESTAMP(REPLACE(fr.R_DATE, '\0', '')) AS RposterTime, R_AUTHOR AS RID_MEMBER,
   R_IP AS RposterIP, IFNULL(frm.realName, '') AS RposterName,
   REPLACE(REPLACE(R_MESSAGE, '\n', '
'), '\r', '') AS Rbody,
   IFNULL(frm.emailAddress, '') AS RposterEmail, fre.realName AS RmodifiedName,
   UNIX_TIMESTAMP(REPLACE(fr.R_LAST_EDIT, '\0', '')) AS RmodifiedTime
FROM `utdsm_snitz`.FORUM_TOPICS AS ft
   LEFT JOIN `utdsm_snitz`.FORUM_REPLY AS fr ON (fr.TOPIC_ID = ft.TOPIC_ID)
   LEFT JOIN `SMF_snitz`.smf_members AS ftm ON (ftm.ID_MEMBER = ft.T_AUTHOR)
   LEFT JOIN `SMF_snitz`.smf_members AS fte ON (fte.ID_MEMBER = ft.T_LAST_EDITBY)
   LEFT JOIN `SMF_snitz`.smf_members AS frm ON (frm.ID_MEMBER = fr.R_AUTHOR)
   LEFT JOIN `SMF_snitz`.smf_members AS fre ON (fre.ID_MEMBER = fr.R_LAST_EDITBY)
ORDER BY IFNULL(fr.R_DATE, ft.T_DATE);

No siggy! :D