If a claim asserted in a cross-complaint is established at the trial and the amount so established exceeds the demand established by the party against whom the cross-complaint is asserted, judgment for the party asserting the cross-complaint must be given for the excess; or if it appears that the party asserting the cross-complaint is entitled to any other affirmative relief, judgment must be given accordingly.
When the amount found due to either party exceeds the sum for which the court is authorized to enter judgment, such party may remit the excess, and judgment may be rendered for the residue.
Ca. Civ. Proc. Code § 666