With New York Knicks media day coming and training camp shortly after, Carmelo Anthony is no longer a member of the team. The surprising part: he’s with the Oklahoma City Thunder, not the Houston Rockets as many expected.

Anthony was sent to the Thunder on Saturday, almost immediately after he expanded his list of preferred trade destinations to include them. The Rockets, long his only preferred destination, were left to see Anthony walk to a Western Conference rival.

That’s a disappointing end to a long saga for Houston. The Knicks and Rockets resumed talking about an Anthony trade in early August after much back and forth between the two teams, according to ESPN’s Adrian Wojnarowski. Anthony was reportedly open to waiving his no-trade clause to join James Harden and Chris Paul, and Nene Instagrammed a picture of Anthony in a Rockets uniform. Paul even left a not-so-subtle hint in an interview with Marc Spears of the Undefeated, saying to “sit back and wait” when asked about Melo.

So why is Anthony on Oklahoma City instead?

Because trading him to Houston would have been quite complicated. In the end, too complicated.

Anthony is set to make more than $26 million in 2017-18, the eighth most of any player in the league. To make a trade work, Houston needed to find a way to match that salary within 125 percent in any deal.

Getting rid of its next highest paid player in Ryan Anderson was the best way to do it, but the Knicks didn’t want him and shouldn’t have wanted him. Anderson’s hefty contract starts at more than $19 million and totals more than $61 million over three years. The Knicks did not want to swallow that massive deal, and without Anderson in the deal, a straight-up trade was impossible.

A third team needed to be necessary to make this trade work, but they would have wanted at least one asset, whether it be a first-round pick and/or young player, as a reward for taking on Anderson’s bad contract.

The biggest problem for Houston is that it didn’t have many desirable assets left. The team dealt away its 2018 first-round pick and gave up young prospects in Sam Dekker and Montrezl Harrell to the Clippers as part of the Paul trade.

The bottom line is there weren’t enough young assets to go around to please everyone involved in this trade. That’s why the Knicks instead jumped at the chance to take Oklahoma City’s package of Enes Kanter, Doug McDermott, and a second-round pick once Melo allowed them to do so.

The Anderson dilemma ultimately killed the deal

To shed salary, Anderson and his $19.5 million salary next season would have needed to be moved to make room for Anthony in Houston. But finding a team willing to take on the 29-year-old’s pricy contract over next three years was ultimately impossible. His stock isn’t so high as an aging one-dimensional player, though he shot 40 percent from three-point range last season.

Houston needed to find assets from somewhere else to sweeten an Anderson deal and make his contract digestible for the receiving team. The best it could offer was a 2020 first-round pick, and that wasn’t close to enough.

Trading Anderson wasn’t the only way to acquire Anthony, but the alternative would have meant losing Eric Gordon and Trevor Ariza, who the Rockets need to compete next season. (Houston has a collection of non-guaranteed contracts to include in a trade as well, but they add up to less than $10 million.)

Thus, Houston was backed into a tight corner, relying on other teams to come through with the draft picks and young assets necessary to convince everyone involved.

That’s why the trade never happened.

Which teams could have gotten in?

The Phoenix Suns may have been a team that would have made sense. Since pulling out of a Paul Millsap offer, it’s obvious they’re in rebuild mode, and Woj has reported their interest in a salary dump for picks. But the Rockets couldn’t engage them on a deal.

The Brooklyn Nets are already eating Timofey Mozgov’s contract via the D’Angelo Russell trade and DeMarre Carroll’s deal via a cap-clearing trade with Toronto. That pushed them out of the running for another salary dump.

The Portland Trail Blazers have the league’s second-highest payroll, yet they are far from NBA Finals contention. They could have looked to offload money to lessen their luxury-tax bill in exchange for the Rockets’ stockpile of non-guaranteed contracts.

Instead, they moved Allen Crabbe to the Nets for Andrew Nicholson, who they immediately waived. That removed the need to trim more salary to help the Rockets.

Once Anthony expanded his list, a deal with Houston was doomed

Houston was always the front-runner, but the Rockets’ only leverage was that they were Anthony’s only preferred destination. Anthony wanted a buyout, because that path would clear a much easier route to Houston for him and the Rockets. The Knicks wanted to gain something for the guy they traded Danilo Gallinari, Wilson Chandler, draft picks, and more to get six years ago.

If Houston remained Anthony’s only destination, the Knicks might have been forced to swallow Anderson’s deal or simply waive Anthony. But due to no fault but their own, Anthony had the supreme control over this trade.

That’s why everything changed once he added the Thunder and Cavaliers to his list. That created a real market.

Houston’s lack of assets was ultimately its biggest downfall as it tried to work its second blockbuster trade of the summer. Meanwhile, Anthony’s no-trade clause haunted New York the entire way through negotiations, but at least Anthony’s decision to expand his list allowed them to get a slightly better return than Houston could have offered.

That’s why a Carmelo Anthony to the Rockets trade never happened despite every side being motivated to swing a deal.

This article was originally published on July 12 and later updated on Sept. 20 and Sept. 23.