Given:
- A and B together complete the work in 8 days.
- A alone completes the work in 12 days.
Step 1: Work done per day by A:
\[
\frac{1}{12}
\]
Step 2: Work done per day by A and B together:
\[
\frac{1}{8}
\]
Step 3: Work done per day by B:
\[
\frac{1}{8} - \frac{1}{12}
\]
Taking LCM of 8 and 12, which is 24:
\[
\frac{3}{24} - \frac{2}{24} = \frac{1}{24}
\]
Thus, B alone takes 24 days to complete the work.