I have a file which has 6 different account numbers. For each of this account number, I need to check in File1 which has account number, security and Quantity. I need to sum up the qty field for a combination of Acc num and security. Once I get the security, I need to search in another file say File2 for ISIN vaue corresponding to the security which I got from File1. Please help me to write a SQL query for this. I need to write the output in a summary file.