Q
Problem solve Get help with specific problems with your technologies, process and projects.

Deleting records in SQL database files when fields are duplicated in another file

To delete a file that contains fields duplicated elsewhere, you need to code a subquery on your SQL statement.

How do I delete records in File A when FieldZ and FieldY in File A match the FieldS and FieldT in File B?
You would need to code a subquery on your SQL Delete statement. Here's an example:
DELETE FROM fileA a 
WHERE EXISTS 
(SELECT 1 FROM FileB fieldZ=fieldS AND fieldY=fieldT) 

Dig Deeper on iSeries database management

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close