15 messages in com.mysql.lists.mysqlRe: Multiple tables in delete stateme...| From | Sent On | Attachments |
|---|---|---|
| Augey Mikus | 09 May 2002 07:45 | |
| Jay Blanchard | 09 May 2002 07:57 | |
| Augey Mikus | 09 May 2002 08:04 | |
| Jay Blanchard | 09 May 2002 08:12 | |
| Egor Egorov | 09 May 2002 08:15 | |
| Paul DuBois | 09 May 2002 08:19 | |
| Augey Mikus | 09 May 2002 08:21 | |
| Paul DuBois | 09 May 2002 08:38 | |
| Jay Blanchard | 09 May 2002 09:01 | |
| Gelu Gogancea | 09 May 2002 09:04 | |
| Augey Mikus | 09 May 2002 09:28 | |
| Max Anderson | 09 May 2002 09:59 | |
| Jay Blanchard | 09 May 2002 10:22 | |
| Max Anderson | 09 May 2002 11:37 | |
| Jay Blanchard | 09 May 2002 11:38 |
| Subject: | Re: Multiple tables in delete statement on Mysql 3![]() |
|---|---|
| From: | Gelu Gogancea (gge...@arctic.ro) |
| Date: | 05/09/2002 09:04:11 AM |
| List: | com.mysql.lists.mysql |
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...@gonetsoftware.com gelu...@yahoo.com
----- Original Message ----- From: "Augey Mikus" <mik...@dqc.org> To: "Jay Blanchard" <jay....@niicommunications.com>; <mys...@lists.mysql.com> 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 <mysq...@lists.mysql.com> To unsubscribe, e-mail <mysql-unsubscribe-ggelu=arct...@lists.mysql.com> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




