Anda harus menggunakan subqueries pada int dan ext untuk melakukan penjumlahan, dan bergabung ke subqueries.
Saya juga menyarankan menggunakan JOIN eksplisit daripada tabel, tabel, tabel
misalnya
SELECT emp.Name, int.Amount AS InternalCostTotal, ext.Amount AS ExternalCostTotal
FROM Employees emp
JOIN (
SELECT EmployeeID, SUM(Amount) AS Amount
FROM InternalCosts
GROUP BY EmployeeID
) int ON emp.EmployeeId = int.EmployeeID
JOIN (
SELECT EmployeeID, SUM(Amount) AS Amount
FROM ExternalCosts
GROUP BY EmployeeID
) ext ON emp.EmployeeId = ext.EmployeeID