Solved

MySQL Fulltext Search with Multiple Tables

Posted on 2010-11-21
1
483 Views
Last Modified: 2012-05-10
Hi, I'm trying to write a search query. I'm trying to take advantage of the "Natural Language" search capability.

Here is my query:

SELECT person.personid, person.firstname, person.lastname, facility.name, state.stateLongName, detail.description
FROM person
LEFT JOIN facility ON person.facility = facility.facilityid
LEFT JOIN detail ON person.personid = detail.personid
LEFT JOIN state ON facility.state = state.stateID
WHERE
MATCH (person.firstname, person.lastname, facility.name, state.stateLongName, detail.description)
AGAINST ('Texas')


I have FULLTEXT indexes set up on each of the columns in the MATCH part of the query.

I get the following error:
#1210 - Incorrect arguments to MATCH

Any thoughts on what I'm doing wrong?  I'm using MySQL 5.0.

0
Comment
Question by:ipeng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 34183983
you will need to do like this, using either AND or OR, depends on what exactly you need to be the results.
I post with OR, you can change as needed:
SELECT person.personid, person.firstname, person.lastname, facility.name, state.stateLongName, detail.description
FROM person
LEFT JOIN facility ON person.facility = facility.facilityid
LEFT JOIN detail ON person.personid = detail.personid
LEFT JOIN state ON facility.state = state.stateID
WHERE MATCH (person.firstname, person.lastname) AGAINST ('Texas')
   OR MATCH (facility.name) AGAINST ('Texas')
   OR MATCH (state.stateLongName) AGAINST ('Texas')
   OR MATCH (detail.description) AGAINST ('Texas')

Open in new window

0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question