When two or more civil actions are pending in the same court at the same time for the recovery of the same demand, or against two or more officers, upon receipts for executions arising from the same original judgment, the court shall not allow any costs in any such action, unless it is of the opinion that the commencement of all of the actions was necessary to secure the demand.