List:General Discussion« Previous MessageNext Message »
From:Gelu Gogancea Date:May 9 2002 4:04pm
Subject:Re: Multiple tables in delete statement on Mysql 3
View as plain text  
Hi,
You can use variable.

set @a:=0;        --initialise
select @a:=tablename.id  from tablename,someothertable where tablename.id =
someothertable.id;          --load the variable "a"
delete from tablename where tablename.id=@a;

Regards,
Gelu
_____________________________________________________
G.NET SOFTWARE COMPANY

Permanent e-mail address : gg@stripped
                                          gelugogancea@stripped
----- Original Message -----
From: "Augey Mikus" <mikus@stripped>
To: "Jay Blanchard" <jay.blanchard@stripped>;
<mysql@stripped>
Sent: Thursday, May 09, 2002 6:04 PM
Subject: Re: Multiple tables in delete statement on Mysql 3


> if i say:
>
> delete from tablename where tablename.id = someothertable.id;
>
> mysql complains because there is no reference to someothertable;
> error: Unknown table 'someothertable' in where clause.
>
> So how can I reference both tables without deleting from both tables?
>
> Augey
>
>
> Jay Blanchard wrote:
>
> >[snip]
> >is a statement like this not supported on mysql 3 but is supported in
> >mysql 4?
> >
> >delete table1 from table1,table2 where table1.id = table2.id;
> >[/snip]
> >
> >DELETE FROM tablename WHERE table1.id = table2.id
> >
> >You can only delete from one table at a time.
> >
> >
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> 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-thread108496@stripped>
> To unsubscribe, e-mail <mysql-unsubscribe-ggelu=arctic.ro@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>

Thread
Multiple tables in delete statement on Mysql 3Augey Mikus9 May
  • RE: Multiple tables in delete statement on Mysql 3Jay Blanchard9 May
    • Re: Multiple tables in delete statement on Mysql 3Augey Mikus9 May
      • RE: Multiple tables in delete statement on Mysql 3Jay Blanchard9 May
    • Re: Multiple tables in delete statement on Mysql 3Gelu Gogancea9 May
    • Re: Multiple tables in delete statement on Mysql 3Augey Mikus9 May
  • Re: Multiple tables in delete statement on Mysql 3Egor Egorov9 May
  • Re: Multiple tables in delete statement on Mysql 3Paul DuBois9 May
  • Re: Multiple tables in delete statement on Mysql 3Augey Mikus9 May
    • Re: Multiple tables in delete statement on Mysql 3Paul DuBois9 May
    • MySQL GROUP BY Anomaly?Jay Blanchard9 May
RE: MySQL GROUP BY Anomaly?Max Anderson9 May
  • RE: MySQL GROUP BY Anomaly?Jay Blanchard9 May
  • RE: MySQL GROUP BY Anomaly? SOLVEDJay Blanchard9 May
RE: MySQL GROUP BY Anomaly?Max Anderson9 May