john-formby
asked on
MySQL fulltext search joining tables
Hi,
I have a fulltext search on one of my tables but I want to also search on another table that is linked to another table (I know that doesn't make any sense yet)
I have 3 tables
tblblogarticle
articleID
posterName
articleTitle
articleContent
tblarticletags
articleID
tagID
tbltags
tagID
tagName
I have a fulltext search running on the tblarticle table that looks like this:
mysql_query('SELECT articleID, posterName, articleTitle, articleContent FROM tblblogarticle WHERE MATCH(articleTitle, articleContent) AGAINST ("'.$phrase.'"));
This is working ok, but I woud like to expand my search to include the article tags associated with each article. The link is each article has several entries in the tblarticletags table that stores the articleID and tagID fields. The tbltags table contains the tagID and tagName. I want to search on the tagName with reference back to the original article to display the correct search results.
I guess I am going to have to use joins to do this, but am not sure how to construct it? Any advice is welcomed.
Kind Regards,
John
I have a fulltext search on one of my tables but I want to also search on another table that is linked to another table (I know that doesn't make any sense yet)
I have 3 tables
tblblogarticle
articleID
posterName
articleTitle
articleContent
tblarticletags
articleID
tagID
tbltags
tagID
tagName
I have a fulltext search running on the tblarticle table that looks like this:
mysql_query('SELECT articleID, posterName, articleTitle, articleContent FROM tblblogarticle WHERE MATCH(articleTitle, articleContent) AGAINST ("'.$phrase.'"));
This is working ok, but I woud like to expand my search to include the article tags associated with each article. The link is each article has several entries in the tblarticletags table that stores the articleID and tagID fields. The tbltags table contains the tagID and tagName. I want to search on the tagName with reference back to the original article to display the correct search results.
I guess I am going to have to use joins to do this, but am not sure how to construct it? Any advice is welcomed.
Kind Regards,
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Kind Regards,
John