Delete with Join in MySQL

后端 未结 14 1219
鱼传尺愫
鱼传尺愫 2020-11-22 06:18

Here is the script to create my tables:

CREATE TABLE clients (
   client_i INT(11),
   PRIMARY KEY (client_id)
);
CREATE TABLE projects (
   project_id INT(         


        
14条回答
  •  攒了一身酷
    2020-11-22 07:04

    You can also use ALIAS like this it works just used it on my database! t is the table need deleting from!

    DELETE t FROM posts t
    INNER JOIN projects p ON t.project_id = p.project_id
    AND t.client_id = p.client_id
    

提交回复
热议问题