This is a good question. But is easily answered when you realize Jewish custom established two kingship dates for co-rulers; one when they became co-ruler and one when they became sole ruler.
To protect the chronology of the Bible for this period, these "kingship" dates were hidden in complex references. Thus it is not possible to get the correct chronology without several comparisons.
For this reference, the kingship of Joram of Israel became sole ruler in the second year of Jehoram of Judah. Jehoram of Judah, though, became king in the fifth year of Joram counted from his co-rulership with his father Ahab which began, obviously, five years earlier.
So just for a little background, Ahaziah of Israel became king in the 17th year of Jehoshaphat, but died in his second year a year later. But this was still during the reign of Ahab. They were co-rulers. So after that another king was appointed, his brother, Joram who became king in the 18th year of Jehoshaphat, also co-ruler with his father Ahab.
Then five years later, a co-ruler in Judah was appointed, Jehoram in the 5th year of Joram. The following year, in the sixth year of Joram, Ahab died and thus he "became king" as sole ruler in his sixth year, but also the second year of Jehoram.
So that's the secret to this dating; understanding the two kingship references and coordinating them; one being the co-rulership kingship date and the other the sole rulership date.
There is no contradiction.
At the same time, this makes it too complex to go in and change the chronology that is so interconnected. You can't revise something you can't understand. Thus this protects the chronology for this period; but causes lots of confusion for those who don't understand how the corulerships worked.
Another prime example is Ahaziah of Judah who is said to have become king in both the 11th and 12th years of Joram; meaning his father died within a year of his becoming co-ruler king, and since he was killed within that year, he is said to have only ruled for one year.
What is most significant, though, about these dates is that the later date, when it can be determined, is the year the previous father-king died. Thus it is more significant that Ahab died in the 2nd year of Jehoram than Joram becoming king that year. This allows us to correct the chronology for this kingship for this period.
Hope this was a help.