MDL-35453 avoid subquering outer-joined columns

This prevents ORA-01799: a column may not be outer-joined to a subquery,
happening when a column from an outer joined table is used for subquery matches.

Ideally the "m_quiz_attempts quiza" should be an INNER join, but as far as
conditions are multiple and some of them require to show users without attempts
the OUTER join must be preserved.

That automatically implies that not "quiza" column can be used to match
a subquery. The modification simply avoids that restriction with an equivalent
and related subquery/implicit view using EXISTS.

Also, the queries have moved away from using "id" to detect oldest/first/last,
changing to better "attempt" that keeps the real order for each quiz/user tuples.