You are not being honest with us on the list.....

Firstly, the error you got:

You have an error in your SQL syntax near 'USING USING
A
RIGHT JOIN B ON B.id = A.sectionid' at line 1
SQL=DELETE FROM A USING A
RIGHT JOIN B ON B.id = A.sectionid WHERE B.id is null

indicates that you used the USING keyword twice in your query, which
won't work in any version of MySQL.

I tried to replicate what you have:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1568 to server version: 4.1.12-standard-log

mysql> create table A (A int, sectionid int);
Query OK, 0 rows affected (0.31 sec)

mysql> create table B (id int, A int);
Query OK, 0 rows affected (0.23 sec)

mysql> select * from A USING A RIGHT JOIN B ON B.id=A.sectionid WHERE
B.id is null;
ERROR 1064 (42000): 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 'USING A RIGHT JOIN B ON B.id=A.sectionid WHERE
B.id is null' at line 1

As you can see, on MySQL 4.1.12 I'm getting an error.  ( I used select
* from instead of delete from because that's how I test out delete
queries to make sure I don't do something dumb).

I think you don't want the "USING A" at all:
select * from A RIGHT JOIN B ON B.id=A.sectionid WHERE B.id is null;

works just fine for me.

And it's true that in 3.23 you could not do a multiple-table UPDATE
(that was introduced in 4.0.0).  So I'm guessing that's what you
really meant.

Why are you even bothering, though?  why not just use

DELETE FROM A WHERE sectionid IS NULL;
DELETE FROM B WHERE id IS NULL;

?  Because that's all you're really doing in those queries.

Not that it needs to be said, but you should upgrade.

-Sheeri

On 5/4/06, The Nice Spider <[EMAIL PROTECTED]> wrote:
>> This query running fine on 4.0.25 but when trying
on
>> 3.23 an error occurs.
>> can one help me to find correct command for 3.23?
> Probably if you post the error message you get.
>
DELETE FROM A
USING A
RIGHT JOIN B ON B.id = A.sectionid
WHERE B.id is null

error message on 3.23 is:
You have an error in your SQL syntax near 'USING USING
A
RIGHT JOIN B ON B.id = A.sectionid' at line 1
SQL=DELETE FROM A USING A
RIGHT JOIN B ON B.id = A.sectionid WHERE B.id is null

BUT this query run ok in 4.0.25. i need to find error
free syntaks for 3.23
version. any help?


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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



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

Reply via email to