I'm trying to do a delete on two tables at once.

sucessfully does it with update,

UPDATE table1 INNER JOIN table2 ON table2.table1_id = table1.ID SET table1.whatever = Whatever, table2.whateveer = Whatever

is there a way to do this with the DELETE function

DELETE table1 INNER JOIN table2 ON table2.table1_id = table1.id WHERE table1.ID = 1

doesn't work

thanks in advanced.

When deleteing from multiple tables, you need to specify what is being deleted. There are two available syntaxes:

DELETE table1, table2 
FROM table1 INNER JOIN table2 ON table1.id = table2.id 
WHERE table1.id = 1

or:

DELETE FROM table1, table2 
USING table1 INNER JOIN table2
WHERE table1.id=table2.id AND table1.id = 1

Hope this helps.

thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.