Mansukhdeep Thind wrote:
I''m not sure, but depending on your database you might be able to use a nested query for this e.g.
I don't use
JDBC myself, so you'll need to figure out how to pass in the list of values for comparing with
table2.column3, but that's a separate issue.
You don't want to execute a DELETE until you're sure you are removing the right records, so I suggest you get the nested query working first, so you can be sure it's identifying the right records in
table2. Then check the subquery works when querying from
table1, by doing
SELECT * FROM table1 in the above SQL instead of
DELETE FROM table1. If this query returns the records from
table1 that you want to delete, then you can go ahead and implement the
DELETE statement.
Use your database's SQL shell to do this, as it will be much easier.