This was due to a mistranslation. The "second" Goliath was in fact a brother of the first. (See 1 Chronicles 20 v 5).
So Elhanan slew Goliath's brother. David slew Goliath.
Further reading shows that when Elhanan slew Goliath's brother, it was at a time when David was already King, therefore it was two separate occasions.
Army horses loose on London streets
To go through chemo therapy or choose not to?
Re painting metal bistro garden set