Skip to content

Deleting with joins #29

@bradenrayhorn

Description

@bradenrayhorn

Is it currently possible to execute a delete query that includes a join? I'd like to be able to do that without running a sub query.

Here is my ideal sql:

DELETE posts
FROM posts
INNER JOIN projects ON projects.project_id = posts.project_id
WHERE projects.client_id = ?

This what I am stuck with now:

DELETE FROM posts
WHERE posts.project_id IN ((
          SELECT posts.project_id
          FROM posts
               INNER JOIN projects ON projects.project_id = posts.project_id
          WHERE project.client_id = ?
     ));

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions