List:MySQL++« Previous MessageNext Message »
From:MailList Date:November 20 2004 9:50am
Subject:Executing multiple table inserts and deletes
View as plain text  
Hello,

i have to do multiple inserts/deletes in one query. I'm trying to use semicolon to
separate the commands, like this:

DELETE FROM... ; INSERT INTO ... ; INSERT INTO...

but didn't work. There is a way to do this?

Another question (it's more about mysql): I have three tables A, B , C and i do inserts on
them:

INSERT INTO A...
INSERT INTO B...
INSERT INTO C...

I have another table, D, that have A, B, C foreign keys, id_A, id_B and id_C. I do this
INSERT:

INSERT INTO D(id_A, id_B, id_C) VALUES (LAST_INSERT_ID(), LAST_INSERT_ID(),
LAST_INSERT_ID());

MySQL knows what "table" to look, using the foreign keys, or just get the last value
inserted in DB?

Thanks in advance.

Thiago Miranda

Thread
Executing multiple table inserts and deletesMailList22 Nov
  • Re: Executing multiple table inserts and deletesWarren Young22 Nov