[EMAIL PROTECTED] wrote:

I have a question about the multiple table delete syntax. First the
documentation on the website is very clear. My question is why not how. The
'delete from using' is not ambiguous (to me). My question is about the form:

   delete t1 from t1,t2 where ...

I would take this to mean remove matching records from t2. I assume the reason
records are removed from t1 is SQL language consistency.  But as an SQL newbie,
I can not see it.

Thanks for any thoughts.

_____
Douglas Denault

The point is to distinguish between the tables which are joined to pick the rows and the tables from which rows are to be deleted. You have 2 options:


  DELETE FROM t1 USING t1,t2 ...

or

  DELETE t1 FROM t1,t2 ...

Perhaps you are extrapolating from 'DELETE FROM t1...' to expect that the second form should delete from both tables, but note that the second form is not 'DELETE FROM t1,t2...', it's 'DELETE t1 FROM t1,t2...'. If you must relate it to something, I'd suggest 'SELECT t1.* FROM t1,t2 ...' is the natural parallel.

Michael


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



Reply via email to