I'm not going to get into an argument about Joram/Jehoram, because it's actually not relevant. All that matters is that 2 Kings 8:25 clearly says it is talking about Ahaziah of Judah, son of Jehoram. It is that Ahaziah that is being spoken of, who reigned in Jerusalem two and twenty years, according to 2 Kings.
In 2 Chron 22:1:2, it again spells out that it is talking about Ahaziah son of Jehoram king of Judah, this time with the number of forty and two.
It is actually not relevant whether you think the Ahaziah of 2 Kings 8:24 is a different Ahaziah on the basis of the differing names of Jehoram/Joram. The fact is, both accounts clearly spell out which Ahaziah (if there was more than one in Judah) they are talking about, and it is in that context that the numbers appear to differ.
As a side note, while there is obviously an Ahaziah of Israel (son of Ahab, 1 Kings 22), it is not the same Ahaziah spoken of in 2 Kings 8:24. The fact that 8:24 is clearly speaking of a King of Judah, given the discussion of a burial in the city of David (Jerusalem), is enough to settle that point. Joram of Israel did not beget Ahaziah of Israel, and I challenge you to find a verse that unambiguously says so. Instead, Ahaziah King of Israel died, was succeeded by his brother Jehoram/Joram(2 Kings 1), who then was killed by his general Jehu in order to end the line of Ahab (2 Kings 9), an episode Ahaziah of Judah was involved in, being himself killed by Jehu but then buried in Jerusalem (2 Kings 9:28-29). Jehu then became King of Israel, with Ahaziah of Judah's mother becoming regent until his son took the throne.
In other words, 2 Kings 8:24 is speaking of Ahaziah of Judah (even though which Ahaziah is being spoken of there is irrelevant). 8:25 is clearly speaking of Ahaziah of Judah. There are two Ahaziahs mentioned in 2 Kings, but only one is spoken of in 8:24, and it is the same one spoken of in 2 Chron 22:1-2.
All of that to say.... find a better solution