First I should clarify that the reference in beginning of 2 kings is to a rebellion not a full fledged war (this can be proven from 3:4-5 cited later). Moab rebelled against Israel which led to a war between Israel and Moab (recorded in chapter 3). Israel sent for Judah to be her ally and to go with her to wage war against Moab. The king of Judah at that time was Jehoshaphat. This is recounted in detail in 2 Kings chapter 3:4-8,
Meanwhile, Moab’s King Mesha was a sheep breeder. He used to pay
100,000 lambs and the wool from 100,000 rams to the king of Israel as
tribute. 5 After Ahab died, the king of Moab rebelled against the king
of Israel. 6 So King Jehoram left Samaria at that time[e] and mustered
the entire army of[f] Israel. 7 As he was going out, he sent this
message[g] to King Jehoshaphat of Judah: “The king of Moab has
rebelled against me. Will you go with me to fight Moab?” “I’m coming,”
Jehoshaphat[h] replied. “I’m like you! My army will act like your army
and my cavalry like your cavalry,”
It seems likely that the text here is only continuing from where it left off in chapter 1 (2 Kings). The book started with the rebellion of Moab; now it is returning to that and explaining what ensued right after this rebellion. Except that the king of Israel going into battle is Jehoram not Ahaziah! Why is that? The reason is simple: because Ahaziah died (he fell from the lattice) before he was able to organize his army, so his successor finished up what his predecessor wasn't capable of doing. So the chronology of events looks something like this:
- Ahab dies, Mesha king of Moab rebels (chapter 1).
- Ahaziah organizes an army to go out and subdue them, but he dies before he is able to participate in this battle (this event is not recorded in the bible, but is an educated guess of what must have happened).
- Jehoram his successor organizes his army and calls for Jehoshaphat to join his cause. Together they successfully defeat Moab and Ammon (chapter 3).
It seems likely that the war which Jehoshaphat wages in Chronicles is the same war described in 2 kings 3. Even it is not that same battle it must have been a continuation of that war. It is possible that the Moabites were mad at Judah for joining Israel's battle against them, so they come back the next year to show Judah that the war is not yet over (2 Chronicles 20:1). In any case, the battle in 2 Kings 3 must have preceded the one in 2 Chronicles, since Jehoshaphat was first recruited by Jehoram and only got involved in this war against Moab through Israel. So my educated guess is that Jehoram first recruited Jehoshaphat to join him in battle against the rebelling Moabites. Once Judah was involved in this as well, another battle ensued the next year between Moab and Judah (possibly Israel too, only the author of Chronicles doesn't tell us) in which Moab was defeated once again and for all, as is recounted in 2 Chronicles 20.