SELECT
"ID" AS "ID",
"strName" AS "Borrower Name",
SUM(("Mortgage" + IF("Amount" IS NOT NULL,"Amount",0))) AS "Total Owed"
FROM
"TableA"
LEFT OUTER JOIN
"TableB"
ON
"MLoan" = "OLoan"
GROUP BY
"ID", "strName"
ORDER BY
"ID"
ASKER
ASKER
SQL (Structured Query Language) is designed to be used in conjunction with relational database products as of a means of working with sets of data. SQL consists of data definition, data manipulation, and procedural elements. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control.
TRUSTED BY
SELECT Sum(U.Amount) as AmountOwed
FROM (
SELECT TableA.Mortage as Amount
FROM TableA
UNION ALL
SELECT TableB.Amount
FROM TableB
) as U