MySQL Forums
Forum List  »  Newbie

Re: Searching and Cross Referencing Multiple Tables
Posted by: Ben Blackmore
Date: February 23, 2009 06:36AM

Hi Rick

Thanks for the reply.

Where you have JOIN at the top, do you mean I should use JOIN following on from my existing SQL query with your code after, or replace my entire SQL query with you code? Adding your quiery to mine with JOIN would end up with:

(SELECT
table1.referenceID,table1.email,
MATCH(description,keywords) AGAINST('$search') AS score
FROM table1 WHERE
MATCH(description,keywords) AGAINST('$search' IN BOOLEAN MODE)
ORDER BY score DESC)
JOIN
(SELECT table2.referenceID,table2.email,
MATCH(description,keywords) AGAINST('$search') AS score
FROM table1, table2 WHERE MATCH(description,keywords) AGAINST('$search' IN BOOLEAN MODE)
AND table1.referenceID = table2.referenceID
ORDER BY score DESC)

Also, in your example you had 'table2.email' but there is no email column in table2. Is this a mistake, or how you cross reference the 2 tables?

Many thanks

Ben



Edited 1 time(s). Last edit at 02/23/2009 06:40AM by Ben Blackmore.

Options: ReplyQuote


Subject
Written By
Posted
Re: Searching and Cross Referencing Multiple Tables
February 23, 2009 06:36AM


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.