Hi all!
I've got this piece of SELECT statement for MySql.
SELECT *
FROM messages
LEFT OUTER JOIN main
ON messages.topicid=main.topicid
WHERE main.topicid is null;
so the select statement works fine. But what I'd like to do is actually
delete those rows instead. but substituting SELECT with
To: [EMAIL PROTECTED]
Subject: Why does my delete not work :(
Hi all!
I've got this piece of SELECT statement for MySql.
SELECT *
FROM messages
LEFT OUTER JOIN main
ON messages.topicid=main.topicid
WHERE main.topicid is null;
so the select statement works fine. But what I'd like to do is actually
Good morning Sunny,
From: sunny [EMAIL PROTECTED]
...substituting SELECT with DELETE doesn't work :(
That's right, that's how MySQL works. And it doesn't support sub-queries for this
case, either. So you can't say:
delete from table where field in (select field from other_table)
I'd
So you're saying there's no actual DELETE statement for this? There is no
way in hell I can write any SQL to do that?? Thats sucks... :(
Thanks for the example, but how do I run it? I've only used PHP for taking
information out of a database and other simple MySQL queries so while your
Here:
?
$sql = DELETE [columumname] FROM [tablename] WHERE id = '$id';
That's your basic delete statement in PHP.
-Original Message-
From: sunny [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 6:18 PM
To: Rodney Broom; [EMAIL PROTECTED]
Subject: Re: Why does my delete
; [EMAIL PROTECTED]
Subject: Re: Why does my delete not work :(
So you're saying there's no actual DELETE statement for this? There is
no
way in hell I can write any SQL to do that?? Thats sucks... :(
Thanks for the example, but how do I run it? I've only used PHP for
taking
information
($result)) {
$sql2 = DELETE FROM messages WHERE topicid = $row =[0] ;
}
-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 6:47 PM
To: 'sunny'; 'Rodney Broom'; [EMAIL PROTECTED]
Subject: RE: Why does my delete not work :(
Sunny
Hi sunny,
Yes it is a sad scenario. But hopefully this feature would be available in
the near future.
If you cannot use a programming language the only way AFAIK is to use
temporary tables.
Create temporary table temptable SELECT messages.*, if(main.topicid is
null,1,0) deleteflag
FROM