You can't have two tables in the UPDATE query, at least not in v3.x of
MySQL. I'm not sure about version 4. That's why it's complaining about
table2. I think the SUBSTRING_INDEX should be OK.

You may have to split your query into a series of queries. There is some
guidance in the MySQL manual.

John Bonnett

-----Original Message-----
From: Davy Obdam [mailto:[EMAIL PROTECTED]
Sent: Friday, 30 May 2003 6:57 PM
To: MySQL; MySQL-WIN
Subject: Update query with substring


Hello people,

I am trying to run this query:

UPDATE table1, table2 SET table1.periode = table.periode WHERE table1.id 
= 3 AND SUBSTRING_INDEX( table1.name, '.', - 1 ) = table2.name

But i keep getting the same error message

You have an error in your SQL syntax near '
table2 SET table1.periode = table2.periode WHERE table1.id = 3 AND 
SUBSTRIN' at line 1

Is it possible to use a SUBSTRING_INDEX in a update query, or what i am 
i doing wrong?

Any help is appreciated, thanks for your time

Best regards,

Davy Obdam

-- 
-----------------------------------------------------------------------
Davy Obdam 
Web application developer

Networking4all
email: [EMAIL PROTECTED]
email: [EMAIL PROTECTED]
internet: http://www.networking4all.com
-----------------------------------------------------------------------




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to