get_class_id()."` AS m LEFT JOIN `User` AS usr ON m.`User_ID` = usr.`User_ID` LEFT JOIN `Subdivision` AS sub ON m.`Subdivision_ID` = sub.`Subdivision_ID` LEFT JOIN `Sub_Class` AS cc ON m.`Sub_Class_ID` = cc.`Sub_Class_ID` $order_by $sort_by) UNION (SELECT usr.`Login`, m.`Message_ID`, m.`Created`, m.`Subject`, m.`Message`, ".$last_reply_link.", 'reply' AS type FROM `Message".$reply_obj->get_class_id()."` AS m LEFT JOIN `User` AS usr ON m.`User_ID` = usr.`User_ID` LEFT JOIN `Message".$topic_obj->get_class_id()."` AS tm ON m.`Topic_ID` = tm.`Message_ID` LEFT JOIN `Subdivision` AS sub ON tm.`Subdivision_ID` = sub.`Subdivision_ID` LEFT JOIN `Sub_Class` AS cc ON tm.`Sub_Class_ID` = cc.`Sub_Class_ID` $order_by $sort_by) ".($cc_env['SortBy'] ? " ORDER BY ".$cc_env['SortBy'] : "")." ".($recNum ? " LIMIT ".intval($recNum) : ($cc_env['RecordsPerPage'] ? " LIMIT ".$cc_env['RecordsPerPage'] : "") ); unset($last_topic_link, $last_reply_link); ?>