select order.id as id, order.customer as customer, order.date as date, order.amount as amount, customer.name as customer_name, salesperson.name as salesperson_name, salesperson.commission * order.amount as commission_earned
from order
left join customer
on order.customer = customer.id
left join salesperson
on customer.salesperson = salesperson.id;