MySQL Forums
Forum List  »  Full-Text Search

Search Two Tables in MATCH? help sql syntax.
Posted by: Elgan Sayer
Date: March 08, 2006 09:23PM

i am trying to write a search script. I have 3 tables where i need info from. 2 to be searched. I have tried various things but what i try usualy locks up the browser.

this is what i have to convert to FULL TEXT SEARCH


"SELECT p.fp_id, t.ft_title, t.ft_id, t.ft_creationdate, t.ft_firstpostername , t.ft_firstposterid,
t.ft_postcount , s.fs_id, s.fs_title
FROM db_forum_posts p, db_forum_topics t, db_forum_sections s
WHERE 1 AND (p.fp_text LIKE '".($sqstr)."' OR t.ft_title LIKE '".($sqstr)."')
$atleastq
$dspresultsp
AND p.fp_topicid=t.ft_id
AND p.fp_sectionid=s.fs_id
GROUP BY t.ft_id");


This is what i tried at first:



SELECT p.fp_id, 
t.ft_title, t.ft_id, t.ft_creationdate, t.ft_firstpostername , t.ft_firstposterid, t.ft_postcount , s.fs_id, s.fs_title 
FROM sed_forum_posts AS p, sed_forum_topics AS t, sed_forum_sections AS s 
WHERE p.fp_topicid=t.ft_id 
AND p.fp_sectionid= s.fs_id 
AND MATCH (p.fp_text) AGAINST ('admin pro') 
OR MATCH (t.ft_title) AGAINST ('admin pro')

but the browser locks up. i also tried

SELECT p.fp_id, 
t.ft_title, t.ft_id, t.ft_creationdate, t.ft_firstpostername , t.ft_firstposterid, t.ft_postcount , s.fs_id, s.fs_title 
FROM sed_forum_posts AS p, sed_forum_topics AS t, sed_forum_sections AS s 
WHERE p.fp_topicid=t.ft_id 
AND p.fp_sectionid= s.fs_id 
AND MATCH (p.fp_text, t.ft_title) AGAINST ('admin pro')
However i get a SQL error for MATCH. #1210 - Incorrect arguments to MATCH

how would i correctly structure this so i can search for text in one table and title text in another table at once and return them and their row? how also would i do it and order by score/relevance.

Would you like to see the tables?

Options: ReplyQuote


Subject
Views
Written By
Posted
Search Two Tables in MATCH? help sql syntax.
9561
March 08, 2006 09:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.