The phase transition and stability as well as corresponding electrical and optical properties of $\mathrm{C}{\mathrm{d}}_{x}\mathrm{Z}{\mathrm{n}}_{1\ensuremath{-}x}\mathrm{O}$ alloys over the entire composition range synthesized under different sputtering conditions, namely, substrate temperature and sputtering environment, were studied. We found that the composition at which the phase transition from the wurtzite (WZ) ZnO-like to rocksalt (RS) CdO-like phase occurs critically depends on the growth temperature and environment during sputter deposition. When deposited at room temperature in pure Ar, the composition window for the coexistence of both the WZ and RS phases is rather narrow ($0.62lxl0.7$). This mixed phase window widens considerably to $0.4lxl0.7$ when alloys were synthesized at $230{\phantom{\rule{0.28em}{0ex}}}^{\ensuremath{\circ}}\mathrm{C}$. When grown in an O-rich environment, pure WZ alloys are stable up to a much higher Cd composition of $x\ensuremath{\sim}0.72$ with a narrow mixed phase region $(0.72lxl0.8)$, resulting in oxide alloys with band gap in the visible range ($\ensuremath{\sim}1.8\phantom{\rule{0.16em}{0ex}}\mathrm{eV}$ for $x\ensuremath{\sim}0.7$). The enhanced WZ phase stability agrees with density functional theory calculations by considering the incorporation of extra O as interstitial defects. Since the optical and electrical transport properties of CdZnO alloys in the WZ and RS phases differ drastically, by adjusting the growth conditions, alloys with desired properties (e.g., band gap and conductivity) can be achieved for different optoelectronic applications.