Mercenary troops should be separated like all other troop types, you shouldn't need to dismiss all of them to upgrade 1 or 2 units.