ar_customers

SELECT * 
FROM ar_customers
customer# customer_name customer_address customer_province customer_rating
1bill 123 main st. ab1
2ed 456 main st. bc2
3john 789 main st. ab3

ar_invoices

SELECT * 
FROM ar_invoices
invoice# customer# salesperson# invoice_date invoice_amount amount_paid current_month_interest_charges total_interest_charges
1112019-06-17 10:43:53.727100.001.000.000.00
2222019-05-28 10:43:53.72750.000.005.0010.00
3322019-06-17 10:43:53.72770.000.0010.0020.00
4212019-07-07 10:43:53.72780.000.000.000.00

ar_salespeople

SELECT * 
FROM ar_salespeople
salesperson# salesperson_name
1bob
2mary
3tim

ar_salespeople

SELECT salesperson_name,
	MAX([Total Sales]) AS [Highest Earner]
FROM
	(SELECT salesperson_name, 
		   SUM(invoice_amount) AS [Total Sales]
	FROM ar_invoices
	INNER JOIN ar_salespeople
		ON ar_invoices.salesperson# = ar_salespeople.salesperson#
	GROUP BY salesperson_name) x
GROUP BY salesperson_name
salesperson_name Highest Earner
bob 180.00
mary 120.00