Skip to content

Delete from table using join to another table #322

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

Merged

Conversation

luksrn
Copy link
Contributor

@luksrn luksrn commented Aug 6, 2016

Support for parse delete from table using join to another table like:

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

This necessitated some changes to the DeleteTest class, specifically:

JSqlParserCC.jjt - changes on grammar of Delete statements.
Delete toString and DeleteDeParser.

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

This necessitated some changes to the DeleteTest class,
specifically:

JSqlParserCC.jjt - changes on grammar of Delete statements.
Delete toString and DeleteDeParser.
@coveralls
Copy link

coveralls commented Aug 6, 2016

Coverage Status

Coverage increased (+0.1%) to 83.883% when pulling b6eb57b on luksrn:delete_from_table_using_join_to_another_table into 1b1655c on JSQLParser:master.

@luksrn
Copy link
Contributor Author

luksrn commented Aug 6, 2016

I was thinking of treating the specific situation of Postgres (using instead join) in a second pull request , but decided to send this before to get some feedback necessary . Even if this request will be approved.

DELETE FROM films USING producers
WHERE producer_id = producers.id AND producers.name = ' foo' ;

@wumpz wumpz merged commit 657eaf3 into JSQLParser:master Aug 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants