mysql broken delete query

Cameron Metcalf cmetcalf at uottawa.ca
Tue Nov 9 11:39:22 EST 2004


Hi all,
I'm stumped. I've got a delete query I use to delete records from one 
table following the consultation of matching unique IDs in multiple tables.

This query worked up until a few days ago. It's being run on MySQL 4.17 
in a Sun environment
but I've also been trying it on a Linux box.

I have done table repairs; I have tried running the query in a terminal 
session and from a PHP page;
I have checked my user permissions and changed them, then reverted back 
without any success, but I still
can't get the query to work.

The syntax I am using comes directly from the MySQL documentation:
http://www.trans-alliance.am/doc/mysql/en/DELETE.html

DELETE FROM rsrc_linx_specialty USING rsrc_linx_specialty rls, rsrc_linx 
rl, rsrc_linx_type rlt WHERE rls.specialtyID = '5' AND rls2.sectorID = 
'1' AND rls2.linxID = rl.linxID AND rl.linxID = rlt.linxID AND 
rlt.typeID = '2';

Variations I have tried:

DELETE FROM rsrc_linx_specialty AS rls1 USING rsrc_linx_specialty AS 
rsl2, rsrc_linx AS rl, rsrc_linx_type AS rlt WHERE rls2.specialtyID = 
'5' AND rls2.sectorID = '1' AND rls2.linxID = rl.linxID AND rl.linxID = 
rlt.linxID AND rlt.typeID = 2;

DELETE FROM rls  USING rsrc_linx_specialty AS rls, rsrc_linx AS rl, 
rsrc_linx_type AS rlt WHERE rls.specialtyID = '5' AND rls.sectorID = '1' 
AND rls.linxID = rl.linxID AND rl.linxID = rlt.linxID AND rlt.typeID = '2';

In every case, I get a syntax error close to the word "USING"

Depending on what variant of the query I'm using:
ERROR 1064: You have an error in your SQL syntax near ' USING 
rsrc_linx_specialty AS rls, rsrc_linx AS rl, rsrc_linx_type AS rl' at line 1

Any suggestions would be appreciated.

Cameron Metcalf
University of Ottawa - Library Network, Systems







More information about the Web4lib mailing list