Worst loan per branch
For each branch, return the ACTIVE loan with the highest days_past_due.
A NULL days_past_due means the loan is not yet due, so treat it as 0. If two or more loans tie for the highest, return all of them.
output columns
branch_codeloan_iddays_past_dueuses
ctrl + enter to run on the sample data · ctrl + shift + enter to submit
run your query to see the output here. Submit checks it against the sample data, hidden test cases, random data and a large dataset.