Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting with joins #29

Closed
bradenrayhorn opened this issue Feb 10, 2020 · 3 comments
Closed

Deleting with joins #29

bradenrayhorn opened this issue Feb 10, 2020 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@bradenrayhorn
Copy link

bradenrayhorn commented Feb 10, 2020

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 = ?
     ));
@go-jet
Copy link
Owner

go-jet commented Feb 10, 2020

Hi @bradenrayhorn, thanks for reporting the issue, it helps with prioritising new features for next releases.

Currently mysql delete with join is not supported, support will be added in some of the future releases.

@go-jet go-jet added the enhancement New feature or request label Feb 10, 2020
@bradenrayhorn
Copy link
Author

Ok, thank you. I look forward to this future release.

@go-jet
Copy link
Owner

go-jet commented Dec 8, 2021

This feature is now implemented in the develop branch and will be released later with release 2.7.0 version.

Delete with join is now possible with USING clause - Sample test

@go-jet go-jet added this to the Version 2.7.0 milestone Dec 8, 2021
@go-jet go-jet mentioned this issue Jan 20, 2022
@go-jet go-jet closed this as completed Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants