When PCs are involved in mass combat, how would the war work?

I want my PCs to be part of a battle and also want the rest of the battle to go on around them. Would my PC have to fight an endless line of NPCs untill the battle is over and one of the sides has won?