SELECT standards.standard_id, standards.title, standards.level,standards.credits, SUM(standards.credits), standards.assessment
CASE WHEN standards.assessment = 1 THEN 'External' ELSE 'Internal' END CASEFROM sta
ON (reports.standard_id = explanation_system_standards.standard_id) reports.status = 'warning' AND reports.datum = (SELECT MAX(datum) FROM reports) AND explanation_system_standards.dismissed_at= explanation_system_standards.standard_id AND reports.system_