P was the owner and holder of the first and second mortgages on the real estate involved in this action. In December 1990, D entered into a written lease agreement, leasing the property in question. The lease was for three years and will expire on January 1, 1994. D occupies the property under the terms of the lease described. D has not recorded its lease, and there is nothing of record indicating it has a leasehold interest in the property. In 1991, a mechanic's lien foreclosure action was filed against the property and its owners. P was made a party to this action and filed a petition to foreclose the first and second mortgages. P had actual knowledge that D was in possession of and occupying the property in question. P did not join D as a party to its action to foreclose the two mortgages. The mortgages were foreclosed, and P purchased the property at the sheriff's sale. P made demand upon D to quit and vacate the premises. D refused and P filed for forcible detainer. D filed a motion for summary judgment, claiming that its interest in the property was not affected by the foreclosure action to which it was not made a party. The court granted summary judgment in favor of D. P appealed.