When a trial court imposes a consolidated sentence in multiple cases, it must award custody credits related to an earlier case even when the earlier case was in a different county. In December 2008, Phoenix was convicted of a crime in Sacramento County and received a 32-month prison term. He was out of custody in October 2009 when he was arrested for shoplifting in Yolo County. He was returned to state prison custody and demanded resolution of the Yolo County case. Phoenix was then removed from state prison for the Yolo County case and spent time in custody to determine his competency. After being found competent to stand trial, Phoenix pled no contest to felony theft in the case. When the Yolo County Superior Court imposed sentence it resentenced on the Sacramento case, making it the subordinate term and consolidating the sentences as required. It refused to calculate custody credits in the Sacramento case based on lack of jurisdiction. Phoenix appealed. Held: Reversed. “In pronouncing a single aggregate term and imposing the combined sentences as though they were all counts in the current case as required under [Penal Code] sections 669 and 1170.1 and [California Rules of Court,] rule 4.452, the Yolo County trial court became the sentencing court for both the Yolo and Sacramento cases.” As such, it was required to award custody credits. Although Phoenix was not entitled to credit for pretrial confinement for his competency evaluation for the time he was still serving his Sacramento sentence (Pen. Code, § 2900.5, subd. (b)), he may have served the entire term in that case prior to the Yolo sentencing. If so, he is entitled to have the excess credits applied against his Yolo County term. Remanded.