[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: Delete with join in mysql 4.0.2
From:       Mark Matthews <mark () mysql ! com>
Date:       2002-08-31 11:52:13
[Download RAW message or body]

Christian Longberg wrote:
> I have just upgraded to mysql 4 to be able to perform delete queries
> with join statement. I have a simple query where I would like to delete
> a number of rows in tabel t1 depending on id's found in table t2. This
> doesn't seem to work and I just don't understand why!?
> 
> mysql> delete icl from ca_x_ind_com_lvl as icl, ca_individual as ind
> where icl.ind_id = ind.ind_id and ind.acc_id_id = @acc_id;
> ERROR 1066: Not unique table/alias: 'icl'
> 
> Where @acc_id is set by: set @acc_id = 2;
> 
> What am I doing wrong?
> 
> BR
> Christian

You have a column named "icl" and have aliased a table as "icl". MySQL 
can't figure out which icl to use. You should use a different alias for 
ca_x_ind_com_lvl, or fully-specify the icl column as tablename.columnname.

	-Mark


-- 
For technical support contracts, visit https://order.mysql.com/?ref=mmma

     __  ___     ___ ____  __
    /  |/  /_ __/ __/ __ \/ /  Mark Matthews <mark@mysql.com>
   / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
  /_/  /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
         <___/ www.mysql.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <mysql-thread118481@lists.mysql.com>
To unsubscribe, e-mail <mysql-unsubscribe-mysql=progressive-comp.com@lists.mysql.com>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic