I have two tables in MySQL
#messages table :
messageid
messagetitle
.
.
#usersmessages table
usersmessageid
messageid
userid
.
.
Now if I want to delete from messages table it's ok. But when I delete message by messageid the record still exists on usersmessage and I have to delete from this two tables at once.
I used the following query :
DELETE FROM messages LEFT JOIN usersmessages USING(messageid) WHERE messageid='1' ;
Then I test
DELETE FROM messages , usersmessages
WHERE messages.messageid = usersmessages.messageid
and messageid='1' ;
But these two queries are not accomplishing this task .
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…