There is a general method to safely change order of integration or summation. First write all of the ranges as inequalities, i.e.,
$$ a \leq x \leq y $$
$$ a \leq y \leq z $$
$$ a \leq z \leq b $$
Combine them into a single chain of inequalities, i.e.,
$$ a \leq x \leq y \leq z \leq b $$
Break...