Problem with DELETE USING

2003-11-05 Thread Bamelis Steve
Hi, 

I'm a newbie when it comes to mySQL.

I have the following command.

 

DELETE FROM tblTest2 

USING tblTest2,tblTest 

WHERE tblTest.Name = tblTest2.Name 

AND tblTest.URL = tblTest2.URL 

AND tblTest.Comment = tblTest2.Comment

 

I get the following error:

You have an error in your SQL syntax near 'USING tblTest2,tblTest WHERE
tblTest.Name = tblTest2.Name AND tblTest.URL = tblT' at line 1

 

I want to delete rows from tblTest2 where there are similarities in tblTest.

In fact using a subselect or something.

 

Could anyone help me please,

Thx

 

 



Re: Problem with DELETE USING

2003-11-05 Thread Leo Huang
Bamelis,

The error message doesn't seem to match your SQL...

It only shows up to 'AND tblTest.URL = tblT'
but your SQL is 'AND tblTest.Comment = tblTest2.Comment'
Is that a problem??

An example from  MySQL manual is 'DELETE FROM t1,t2 USING t1,t2,t3 WHERE 
t1.id=t2.id AND t2.id=t3.id'

Leo

Bamelis Steve wrote:

Hi, 

I'm a newbie when it comes to mySQL.

I have the following command.



DELETE FROM tblTest2 

USING tblTest2,tblTest 

WHERE tblTest.Name = tblTest2.Name 

AND tblTest.URL = tblTest2.URL 

AND tblTest.Comment = tblTest2.Comment



I get the following error:

You have an error in your SQL syntax near 'USING tblTest2,tblTest WHERE
tblTest.Name = tblTest2.Name AND tblTest.URL = tblT' at line 1


I want to delete rows from tblTest2 where there are similarities in tblTest.

In fact using a subselect or something.



Could anyone help me please,

Thx





 



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


Re: Problem with DELETE USING

2003-11-05 Thread Victoria Reznichenko
Bamelis Steve [EMAIL PROTECTED] wrote:
 
 I'm a newbie when it comes to mySQL.
 
 I have the following command.
 
 DELETE FROM tblTest2 
 
 USING tblTest2,tblTest 
 
 WHERE tblTest.Name = tblTest2.Name 
 
 AND tblTest.URL = tblTest2.URL 
 
 AND tblTest.Comment = tblTest2.Comment
 
 I get the following error:
 
 You have an error in your SQL syntax near 'USING tblTest2,tblTest WHERE
 tblTest.Name = tblTest2.Name AND tblTest.URL = tblT' at line 1
 
 
 I want to delete rows from tblTest2 where there are similarities in tblTest.
 
 In fact using a subselect or something.

What version of MySQL server do you use?
The above DELETE syntax is supported from v4.0.2.


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com





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



Re: Problem with DELETE USING

2003-11-05 Thread Victoria Reznichenko
Wednesday, November 05, 2003, 1:46:13 PM, Bamelis Steve wrote:

BS Hi Victoria,

BS I just found a manual for my version.
BS Seems that 'USING' doesn't exist in this version.
BS But I really need to be able to delete rows from my source table with
BS specific criteria from my destination table.
BS Is there a work around for this?

In v3.23 you can't do it with one query. Use programming language to retrieve rows 
with SELECT statement and then DELETE these rows from tblTest2.


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com





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