select sum(don.amount) as total, d.destination, p.project from commitments c inner join donations don on c.commitmentid = don.commitmentid inner join destinations d on don.destination = d.id inner join projects p on don.project = p.id where don.active = 'Y' and don.includeincalc = 'Y' and don.verified = 'Y' group by d.destination, p.project order by p.project, d.destination ERROR: Table 'mfoundation_2015.commitments' doesn't exist