Tags: mysql
Rating:
# All A-Loan
De Monne has reason to believe that DEADFACE will target loans issued by employees in California. It only makes sense that they'll then target the city with the highest dollar value of loans issued. Which city in California has the most money in outstanding Small Business loans? Submit the city and dollar value as the flag in this format: `flag{City_$#,###.##}`
Use the MySQL database dump from **Body Count**
## Query
```sql
SELECT em.city, SUM(lo.balance) AS highest_outstanding_loans
FROM `loans` AS lo
JOIN customers AS cu ON cu.cust_id = lo.cust_id
JOIN employees AS em ON em.employee_id = lo.employee_id
JOIN loan_types AS lt ON lt.loan_type_id = lo.loan_type_id
WHERE em.state = 'CA' AND lt.loan_type_id = 3
GROUP BY em.city
ORDER BY highest_outstanding_loans DESC
```
## Flag
`flag{Oakland_$90,600.00}`