Vous pourriez faire
select s.x, s.mz, stuff.y
from (select x, max(z) as mz from stuff group by x) s
left join stuff on stuff.x = s.x and stuff.z = s.mz;
Vous pourriez faire
select s.x, s.mz, stuff.y
from (select x, max(z) as mz from stuff group by x) s
left join stuff on stuff.x = s.x and stuff.z = s.mz;