Window functions are supported in MySQL 8.0 only. In earlier versions, one workaround uses a correlated subquery:
select x, y, z,
(select t1.x from mytable t1 where t1.y = t.y and t1.z = t.z and t1.x > t.x order by t1.x limit 1) as lead_x
from mytable t
This somehow assumes no duplicates (x, y, z)
(otherwise, the result may differ - but the results of the window functions are not stable in that case anyway).
You could also use aggregation rather than limit
:
select x, y, z,
(select min(t1.x) from mytable t1 where t1.y = t.y and t1.z = t.z and t1.x > t.x ) as lead_x
from mytable t