I have forums on my site that use these 2 tables below there is a topic table and a reply to topic table, I would like to show on a users profile page the last 5 topics they particiapted in, so if I get the 5 from friend_forum_topic_reply it will not show the topics they started and only ones they replied to so can someone help me join these to tables in a way that will get the most recent topics they participated in as the creator of replied.
user_id is the row in both tables that need to be searched with
I also need to do this the most optimized and fastest way any help appreciated
[code=php]
-- Table structure for table friend_forum_topic
CREATE TABLE IF NOT EXISTS friend_forum_topic (
auto_id int(11) NOT NULL auto_increment,
forum_categry_id int(10) NOT NULL default '0',
user_id int(10) NOT NULL default '0',
subject varchar(255) NOT NULL default '',
topic text NOT NULL,
status enum('Active','In Active') NOT NULL default 'Active',
submit_date datetime NOT NULL default '0000-00-00 00:00:00',
update_time datetime NOT NULL default '0000-00-00 00:00:00',
postcount int(11) NOT NULL default '0',
lastid int(11) NOT NULL default '0',
--
-- Table structure for table friend_forum_topic_reply
CREATE TABLE IF NOT EXISTS friend_forum_topic_reply (
auto_id int(11) NOT NULL auto_increment,
topic_id int(10) NOT NULL default '0',
user_id int(10) NOT NULL default '0',
reply text NOT NULL,
status enum('Active','In Active') NOT NULL default 'Active',
submit_date datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (auto_id),
KEY topic_id (topic_id,user_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=29739 ;
[/code]