Very rarely a knee problem is regarded as hopeless, and the decision is made to do a knee fusion (arthrodesis).
Put simply, the bony ends of the femur and tibia are cut off, together with ligaments and menisci, the synovial joint lining is stripped out, and the two long bones are encouraged to fuse with one another. This leaves a stable painless leg, albeit a stiff one with several inches of shortening. Success depends upon the adequacy of bone stock and the efficacy of the compression together of the bony ends via internal plates or other external devices.
The usual reason for performing an arthrodesis rather than a knee replacement is infection in the joint - in fact often infection of an irretrievably failed knee replacement. It may also be a consequence of a bone tumour.
Sometimes a fusion can much later again be replaced with a knee replacement, allowing some movement in the knee.