Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009
    Posts
    2

    Unanswered: Syntax Error while running a match/against query

    I have copy/pasted a query from mysql manual and have run it. But I have retrieved two different results on two different servers. The first one is exactly as is expected in the manual but the second one tells that there seems to be a syntax error.

    The first server (Which is the test server) is a development computer with xampp installed (MySQL Ver 5.1.33) and the 2nd one (which is the main server) is a host with MySQL Ver 5.0.51a

    Here is what exactly I did:

    1- I built a table with 3 columns named id, title and body while indicating body and title as the parts for furthure full-text-search. Here is the create table code:

    Code:
    CREATE TABLE articles 
    (id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,  
    title VARCHAR(200), body TEXT, FULLTEXT (title,body));
    2- I inserted the sample records mentioned in mysql manual:

    Code:
    INSERT INTO articles (title,body) VALUES
     ('MySQL Tutorial','DBMS stands for DataBase ...'),
     ('How To Use MySQL Well','After you went through a ...'),
     ('Optimizing MySQL','In this tutorial we will show ...'),
     ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
     ('MySQL vs. YourSQL','In the following database comparison ...'),
     ('MySQL Security','When configured properly, MySQL ...');
    3- Then I copy/pasted the sample query with "MATCH...AGAINST..." command:

    Code:
    SELECT * FROM articles
     WHERE MATCH (title,body)
     AGAINST ('database' IN NATURAL LANGUAGE MODE);
    When I ran the above query in the test server, it returned two records. But when I ran it in the main server, it returned the following error:

    Code:
    You have an error in your SQL syntax; 
    check the manual that corresponds to your MySQL server version 
    for the right syntax to use near 'NATURAL LANGUAGE MODE)' at line 3


    Is it because of the MySQL version or anything I am missing?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by fbgp2000
    Is it because of the MySQL version or anything I am missing?
    bingo!!!

    Quote Originally Posted by da Manual
    The IN NATURAL LANGUAGE MODE and IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION modifiers were added in MySQL 5.1.7.
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Aug 2009
    Posts
    2

    I appreciate

    Quote Originally Posted by r937
    bingo!!!
    Thank you r973,

    I will try to persuade my host administrators to upgrade to a newer version tomorrow.

    Thanx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •