
102 Cal.App.3d 309 (1980)
162 Cal. Rptr. 292
THE PEOPLE, Plaintiff and Appellant,
v.
VICTOR HUGO MINJAREZ, Defendant and Respondent. THE PEOPLE, Petitioner,
v.
THE SUPERIOR COURT OF LOS ANGELES COUNTY, Respondent; VICTOR HUGO MINJAREZ, Real Party in Interest.
Docket Nos. 35144, 56174.
Court of Appeals of California, Second District, Division Two.
February 20, 1980.
*311 COUNSEL
John K. Van de Kamp, District Attorney, Donald J. Kaplan and Dirk L. Hudson, Deputy District Attorneys, for Plaintiff and Appellant and Petitioner.
Seymour I. Cohen, under appointment by the Court of Appeal, Quinn Denvir, State Public Defender, and Richard Lennon, Deputy State Public Defender, for Defendant and Respondent and Real Party in Interest.
No appearance for Respondent Court.
OPINION
BEACH, J.
The People appeal in case A-333483 from an order granting defendant 760 days credit against his prison sentence, contending that the order was in excess of the court's jurisdiction. The People have also filed a petition for writ of mandate on the identical issue. We have consolidated the appeal and the petition for extraordinary relief.

PROCEDURAL FACTS:
After being taken in custody on February 4, 1977, on suspicion of murder, defendant was formally charged with murder on February 24, 1977, in case A-333483, the matter at bench.
On April 12, 1977, when the instant case was pending, defendant was placed on probation in case A-326961 for assault with a deadly weapon committed in 1976. As a condition of probation, defendant was ordered to serve one year in the county jail.
On December 19, 1977, in case A-520695, defendant was sentenced to state prison for assault with a deadly weapon upon a police officer *312 and for possession of a concealable firearm by an ex-felon. Both offenses were committed in 1976.
On February 6, 1979, a jury found defendant guilty of voluntary manslaughter in the present case (A-333483), and on March 6, 1979, the trial court imposed a prison sentence, to run consecutive to the sentence appellant was then serving in case A-520695. The court gave appellant credit for 760 days, stating: "He has been held in custody for a period of 760 days for this case, as a result of this incident. And he is entitled to credit therefor."

DISCUSSION:

1. The order is appealable.

(1) In criminal cases, unless permitted by statute, the People have no right of appeal. (People v. Drake (1977) 19 Cal.3d 749, 754 [139 Cal. Rptr. 720, 566 P.2d 622]; People v. Godfrey (1978) 81 Cal. App.3d 896, 900 [147 Cal. Rptr. 9].) Penal Code section 1238, subdivision (a)(5) allows the People to appeal from "[a]n order made after judgment, affecting the substantial rights of the people." Here, the trial court first pronounced judgment and sentence, then ordered that defendant be given credit for 760 days spent in custody. We deem the order granting credit in this case appealable as "[a]n order made after judgment, affecting the substantial rights of the People." (Pen. Code, § 1238, subd. (a)(5); People v. Hyde (1975) 49 Cal. App.3d 97, 103 [122 Cal. Rptr. 297].) Because the trial court's order granting credit reduces defendant's prison sentence, it is also appealable under Penal Code section 1238, subdivision (a)(6), which permits the People to appeal from an order reducing punishment.

2. Defendant is not entitled to 760 days presentence credit.

(2) The issue is whether under Penal Code section 2900.5 defendant is entitled to credit against his sentence for voluntary manslaughter (case A-333483) for the 760 days he spent in jail while awaiting trial and disposition of that charge when he would necessarily have been incarcerated for the majority of that period in two unrelated cases (A-326961 and A-520695). We conclude that under Penal Code section 2900.5 defendant is not entitled to the credit he seeks.
*313 Penal Code section 2900.5 provides for credit to be given for time spent in custody prior to commencement of sentence. It reads in relevant part: "(b) For the purposes of this section, credit shall be given only where the custody to be credited is attributable to proceedings related to the same conduct for which the defendant has been convicted." Section 2900.5 was enacted "to eliminate the unequal treatment suffered by indigent defendants who, because of their inability to post bail, served a longer overall confinement than their wealthier counterparts." (In re Rojas (1979) 23 Cal.3d 152, 156 [151 Cal. Rptr. 649, 588 P.2d 789].) In Rojas, the defendant was serving a prison sentence for manslaughter when he was charged with an unrelated murder. The defendant was then transferred from Soledad state prison to Los Angeles County jail to await trial on the new charge. He was subsequently convicted of second degree murder. The Rojas court concluded that the defendant was not entitled to presentence credit on the new offense because his incarceration was not attributable to that charge but "due to his previous conviction...." (Id. at p. 157.)
Defendant contends that because he was awaiting trial on multiple murder charges, which were nonbailable capital offenses, he would have remained in custody irrespective of his incarceration for prior unrelated offenses in the other two cases; and, therefore, unlike the situation in Rojas, the in-custody period on the murder charges was also attributable to those charges, entitling him to credit therefor. Section 2900.5, subdivision (b) allows presentence credit "only where" custody is attributable to the "same conduct for which the defendant has been convicted." In interpreting that language the court in Rojas stated: "The sensible inference is that a defendant is not to be given credit for time spent in custody if during the same period he is already serving a term of incarceration." (Id. at pp. 155-156.) Here, at the time defendant was in custody on the murder charges, he was simultaneously serving a period of incarceration for prior unrelated offenses. Based on the language of Penal Code section 2900.5, subdivision (b), as interpreted by the Rojas court, we conclude that defendant is entitled to presentence credit only for that period of custody not attributable to his incarceration for previous unrelated offenses, i.e., from February 4, 1977 (day of murder arrest in case A-333483) to April 12, 1977 (date on which incarceration in case A-326961 commenced). The trial court's allowance of presentence credit for all the days defendant spent in custody since his arrest on February 4, 1977, until his sentencing on March 6, 1979, was error and beyond the court's jurisdiction. (People v. Macias (1979) 93 Cal. App.3d 788, 792 [156 Cal. Rptr. 104]; People v. *314 Massengale (1970) 10 Cal. App.3d 689, 693 [89 Cal. Rptr. 237].)
Judgment is reversed and remanded to the trial court with directions to enter an amended judgment in accordance with this decision.
The same issue as on appeal was presented by the People in their petition for writ of mandate. Having decided the issue on appeal, we dismiss the petition for writ of mandate as moot.
Fleming, Acting P.J., and Compton, J., concurred.
A petition for a rehearing was denied March 4, 1980, and respondent's petition for a hearing by the Supreme Court in Crim. No. 35144 was denied April 17, 1980.
