Reference to a column of a table in an inner sub-SELECT of a DELETE statement

"Daniel Caune" <[email protected]> Tue, 31 Oct 2006 15:06:49 -0500
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
Hi,

I encounter an error when I try to use a column of a table in an inner
SELECT of a DELETE statement.  For instance:

CREATE TABLE a(foo int);
CREATE TABLE b(foo int);
CREATE TABLE c(foo int);

DELETE FROM a
  WHERE NOT EXISTS (
    SELECT 1
      FROM b, (
        SELECT b.foo
          FROM b, c
          WHERE c.foo =3D b.foo
            AND b.foo =3D a.foo) AS d
    WHERE b.foo =3D d.foo);

ERROR 1054 (42S22): Unknown column 'a.foo' in 'where clause'


I don't figure out what is wrong there.  This SQL code works at least on
SQL Server or PostgreSQL.

Regards,


--
Daniel CAUNE
Ubisoft Online Technology
(514) 490 2040 ext. 3613


-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]