WITH UNIQUE_ALARMS AS (
SELECT
	MAX(id) AS id,
	source
FROM alarm_events
GROUP BY source
)
SELECT dalarm.displaypath AS description
FROM UNIQUE_ALARMS u
/* Lookup Alarm */
JOIN alarm_events dalarm ON u.id = dalarm.id
/* Lookup Class */
JOIN alarm_event_data dclass ON u.id = dclass.id AND dclass.propname = "Class"
/* Lookup Device */
JOIN alarm_event_data ddevice ON u.id = ddevice.id AND ddevice.propname = "Device"
WHERE dclass.strvalue IN ("Error", "Warning")
  AND ddevice.strvalue NOT IN ("SorterA", "SorterB", "SorterC", "Ignition")
GROUP BY description;