If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Syntax Error while running a match/against query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-06-09, 05:05
fbgp2000 fbgp2000 is offline
Registered User
 
Join Date: Aug 2009
Posts: 2
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?
Reply With Quote
  #2 (permalink)  
Old 08-06-09, 06:24
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
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.
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 08-07-09, 10:57
fbgp2000 fbgp2000 is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On