3 ways to fix: flexible (glue), "telescoping repair coupling" (glue), or compression (no glue) fitting. Where there are tight quarters and there is limited movement:
You can also use an expansion joint - [1]
Or, you can use 4 elbows: