设 $\boldsymbol{A}=\left(\begin{array}{ccc}1 & 0 & 2 \\ 0 & 1 & -1 \\ 1 & 1 & 1\end{array}\right), \boldsymbol{B}=\left(\begin{array}{cc}a & 3 \\ 1 & b \\ 2 & -1\end{array}\right)$.
(1) $a, b$ 取何值时,矩阵方程 $\boldsymbol{A X}=\boldsymbol{B}$ 有解;
(2) 求 $\boldsymbol{X}$.