This query lists employees who earn the largest commission in each location.
SELECT LOCATION, ID, NAME, COMM FROM Q.STAFF, Q.ORG ZZZ WHERE DEPT=DEPTNUMB AND COMM = (SELECT MAX(COMM) FROM Q.STAFF, Q.ORG WHERE DEPT=DEPTNUMB AND LOCATION = ZZZ.LOCATION)
In this query, the subquery first finds the largest commission within a given location. Then, the main part of the query finds who within that location earned that commission. Because the query names two tables, it includes a correlation name that indicates which table contains the LOCATION column.