/** * Returns newest unique occurrences. * @param integer $limit Maximum limit. * @return WSAL_Occurrence[] */ public static function GetNewestUnique($limit = PHP_INT_MAX) { $temp = new self(); return self::LoadMultiQuery(' SELECT *, COUNT(alert_id) as count FROM ( SELECT * FROM ' . $temp->GetTable() . ' ORDER BY created_on DESC ) AS temp_table GROUP BY alert_id LIMIT %d ', array($limit)); }