On a compulsory counterclaim, if the claim or demand of the defendant equals the claim or demand of the plaintiff, judgment must be entered for the defendant; if the claim or demand of the defendant exceeds the claim or demand of the plaintiff and the plaintiff is the party liable to its satisfaction, judgment must be entered against him in favor of the defendant for such excess and all costs.
Ala. Code § 6-8-86 (1975)