re1man
re1man

Reputation: 2367

mysql left join or full join with fulltext search results

I have two tables, titles and contents:

headings                           contents

id      title                   p_id  content url  id

Now I have this mysql_query:

"SELECT id, title FROM headings WHERE 
  MATCH (title) AGAINST('$query') ORDER BY 
  MATCH (title) AGAINST('$query') DESC"

What I wanted to do then is select the content, url from contents after getting the associated id from headings (joining?)....and then order by p_id ascending...Im having difficulty doing this with fulltext search and figuring out how I would join the tables

Upvotes: 1

Views: 756

Answers (1)

Joe Stefanelli
Joe Stefanelli

Reputation: 135868

SELECT h.title, c.contents, c.url
    FROM headings h
        INNER JOIN contents c
            ON h.id = c.id
    WHERE MATCH (h.title) AGAINST('$query') 
    ORDER BY c.p_id 

Upvotes: 2

Related Questions