
870 A.2d 975 (2005)
Blake McSPADDEN, Petitioner
v.
DEPARTMENT OF CORRECTIONS, Respondent.
Commonwealth Court of Pennsylvania.
Submitted on Briefs January 28, 2005.
Decided March 17, 2005.
*976 Blake McSpadden, petitioner, pro se.
Nicole L. Adams, Asst. Counsel, Camp Hill, for respondent.
BEFORE: McGINLEY, Judge, and SMITH-RIBNER, Judge, and JIULIANTE, Senior Judge.
OPINION BY Judge McGINLEY.
Before this Court are the preliminary objections of the Pennsylvania Department of Corrections (DOC) to Blake McSpadden's (McSpadden) petition for review in this Court's original jurisdiction. Also, before this Court is McSpadden's application for summary relief.
McSpadden is incarcerated with DOC at the State Correctional Institution at Albion. On December 23, 1992, McSpadden was sentenced for a burglary conviction to a term of four to twenty-three months to be followed by one year of probation by the Court of Common Pleas of Philadelphia County (trial court). McSpadden was incarcerated until April 23, 1993. On October 8, 1993, McSpadden was found to have violated the terms of his parole and was sentenced to an in-patient drug program. While awaiting a bed at a treatment program, McSpadden was incarcerated from October 8, 1993, until March 4, 1994. McSpadden only completed one of the scheduled nine months in the in-patient drug program and was again found in violation. McSpadden was then incarcerated from May 28, 1994, to August 2, 1995. McSpadden alleges that he then began to serve the probation portion of his sentence. On September 21, 1995, McSpadden was found to be in violation of his probation. The trial court resentenced him to a new sentence of eleven and one-half months to twenty-three months followed by one year of probation. McSpadden was incarcerated from September 21, 1995, to September 6, 1996.
On March 16, 1997, McSpadden was arrested. The trial court found him in violation of his probation and resentenced him to serve three to ten years effective April 10, 1997. The trial court issued an amended order dated July 22, 1998, which gave McSpadden credit for the periods of December *977 23, 1992, to April 23, 1993; October 8, 1993, to March 4, 1994; May 28, 1994, to August 2, 1995; September 21, 1995, to September 6, 1996; and March 16, 1997, to April 10, 1997.
William J. Wolfe (Wolfe), superintendent of DOC, informed the trial court by letter dated October 28, 2003:
The time from 12/23/92 to 04/23/93, 10/08/93 to 03/04/94, 05/28/94 to 08/02/95 and 9/21/95 to 09/06/96 was previously credited towards the original sentence of 4 months to 23 months (with a consecutive 1 years [sic] probation). We have not credited this inmate with this credit.... A letter was sent to your Honor on August 4, 2003 requesting an adjustment on Mr. McSpadden's commitment credit as stated above. The inmate is now back as a Parole Violator and we have sentenced the inmate only awarding him credit from 03/16/97 to 04/10/97, please notify us if your Honor wants the inmate to have the additional credit as stated above.
Letter from William J. Wolfe, October 28, 2003, at 1-2.
In response, the trial court informed Wolfe: "Please be advised that my sentence of April 10, 1997 of 3 years to 10 years was with all appropriate credit for time served." I do not want any additional credit to accrue to the defendant [McSpadden]. (Emphasis in original). Letter from the trial court, November 3, 2003, at 1.
When McSpadden became aware that he did not receive as much credit as originally ordered he made an Inmate's "Request to Staff Member." P. Thompson responded that under the Split Sentence rule "when an inmate is sentenced on the same indictment bill to a term of confinement with a CS [consecutive] term of probation it is known as a split sentence when you violated probation and are resentenced you are not entitled to all the credit served on the original sentence." Inmate's Request to Staff Member, Response, November 3, 2003, at 1. McSpadden filed a grievance regarding his loss of credit which was denied.
McSpadden requests this Court to order DOC to award him 1,050 days of credit. McSpadden alleges that his rights under the Pennsylvania and United States Constitutions were violated when DOC took away the credit of 1,050 days. McSpadden further alleges:
36. Petitioner [McSpadden] contends that when the D.O.C. took away his credit time, it turned one sentence into three separate sentences for a single offense. (4 to 23 months, 1 year probation) (11.5 to 23 months, one year probation) (3 to 10 years).
37. This action violates the Double Jeopardy Clause of the Fifth Amendment of the United States Constitution, which protects against multiple punishments for the same offense....
....
46. Petitioner [McSpadden] also states that he should not be subjected to a (2001) ruling, when he received his credit time in 1998. This would violate the Ex Post Facto law of the Pennsylvania and U.S. Constitutions.
....
53. Petitioner [McSpadden] states that the D.O.C. is responsible for this action not the trial court. They have a mandatory duty to return the Petitioner's [McSpadden] credit because they are in control of computing an inmate's exact time he is entitled to on that sentence.
54. Petitioner [McSpadden] prays that this Court hear this Petition for Review since it's dealing with a legality of a sentence ... and because the Petitioner [McSpadden] has no other appropriate *978 and adequate remedy. (Citations omitted).
Petition for Review, September 3, 2004, Paragraphs 36-37, 46, 53-54 at 6-8. McSpadden also applies for summary relief because he alleges that no material facts are in dispute, his right to relief is clear, and he is entitled to summary relief as a matter of law.
On October 7, 2004, DOC preliminarily objected in the nature of a demurrer on the basis that McSpadden fails to state a claim upon which relief may be granted.[1] DOC states:
29. In Petitioner's [McSpadden] case, he has not established a clear legal right to relief or a corresponding duty for the Department of Corrections to act.
30. Petitioner [McSpadden] posits his `right' to this credit on his beliefs that Respondent [DOC] has violated his right to due process, violated the Double Jeopardy Clause of the Fifth Amendment to the United States Constitution, will subject him to Cruel and Unusual Punishment, violated Pennsylvania Statute 42 Pa.C.S. § 9760; acted contrary to the holding of Commonwealth v. Williams, 443 Pa.Super. 479, 662 A.2d 658 (1995); and violated the Ex-Post Facto Clauses of the United States and Pennsylvania Constitutions; and acted contrary to the dissenting opinion in Commonwealth v. Bowser, 783 A.2d 348 (Pa.Super.2001)....
....
34. In Williams, the Pennsylvania Superior Court interpreted 42 Pa.C.S. § 9760 and held that the inmate's probation sentence must be credited with the time previously served....
35. The court reached this conclusion because Williams' sentence would have exceeded the maximum time to which he could have been originally sentenced had he not received credit for the prior time served.... A sentence that exceeds the maximum would have been illegal pursuant to 42 Pa.C.S. § 9760....
36. In Bowser, the Pennsylvania Superior Court found that the holding in Williams did not apply.... [T]he court stated that in Bowser's case, his combined sentence did not equal the maximum amount of time to which he could have been sentenced....
37. The court held that Bowser had received this credit that he sought once, and that he was not able to receive duplicate credit in the second component of his sentence.....
38. The Respondent [DOC] argues that the facts of Petitioner's [McSpadden] case are most similar to the facts of Bowser, especially regarding the length of the permissible sentence. Petitioner was sentenced to serve three to ten years of incarceration for Burglary....
39. Petitioner [McSpadden] could have been sentenced to serve a maximum of twenty years of incarceration for burglary....
40. Therefore, because Petitioner [McSpadden] seeks to have only approximately two and one-half years credited to his three to ten year sentence, denying Petitioner [McSpadden] that amount of credit would not force him to serve a *979 sentence greater than the maximum amount allowed, and the court should find in favor of the Respondent [DOC]. (Citations omitted).
Preliminary Objections, October 7, 2004, Paragraphs 29-30, 34-40 at 6-8.
In considering preliminary objections, this Court must consider as true all the well-pleaded material facts set forth in the petitioner's petition and all reasonable inferences that may be drawn from those facts. Mulholland v. Pittsburgh National Bank, 405 Pa. 268, 271-272, 174 A.2d 861, 863 (1961). Preliminary objections will be sustained only in cases clear and free from doubt that the facts pleaded are legally insufficient to establish a right to relief. Werner v. Zazyczny, 545 Pa. 570, 681 A.2d 1331 (1996).
Mandamus is an extraordinary writ designed to compel performance of a ministerial act or mandatory duty where there exists a clear legal right in the plaintiff, a corresponding duty in the defendant and want of any other adequate and appropriate remedy. Princeton Sportswear Corp. v. Redevelopment Authority, 460 Pa. 274, 333 A.2d 473 (1975).
In ruling on an application for summary relief, this Court must view the evidence of record in the light most favorable to the non-moving party and enter judgment only if there are no genuine issues as to any material facts and the right to judgment is clear as a matter of law. Buehl v. Horn, 761 A.2d 1247 (Pa.Cmwlth.2000).
Section 9760(2) of the Judicial Code, 42 Pa.C.S. § 9760(2), provides:
After reviewing the information submitted under section 9737 (relating to report of outstanding charges and sentences) the court shall give credit as follows:
....
(2) Credit against the maximum term and any minimum term shall be given to the defendant for all time spent in custody under a prior sentence if he is later reprosecuted and resentenced for the same offense or for another offense based on the same act or acts. This shall include credit in accordance with paragraph (1) of this section for all time spent in custody as a result of both the original charge and any subsequent charge for the same offense or for another offense based on the same act or acts.
This Court addressed a similar situation. McCray v. Pennsylvania Department of Corrections, 807 A.2d 938 (Pa.Cmwlth.2002). In McCray, Michael McCray (McCray) was arrested and incarcerated after being charged with twenty-seven crimes. On November 5, 1997, he entered a plea agreement where he pled guilty to three charges of aggravated assault, one charge of firearms not to be carried without a license and one charge of criminal conspiracy. McCray was sentenced to eleven and one-half months to twenty months in the Philadelphia County Prison and ten years of concurrent probation with credit for time served. McCray petitioned for reconsideration of his sentence which was granted. McCray's sentence was changed to "Time in to 23 months at the Phila. County Prison. Credit for time served. Immediate parole is Granted. Plus (10) years Probation to run concurrent to be supervised under the State Parole Board." McCray, 807 A.2d at 940.
McCray's probation was revoked and he was sentenced to two to four years of incarceration to run concurrently on the original aggravated assault and criminal conspiracy charges followed by five years of probation on one of the aggravated assault charges. McCray requested that *980 DOC credit his time served under the "time in to twenty-three months ..." sentence. DOC denied the request. McCray then filed a petition for review in this Court's original jurisdiction and alleged that DOC had calculated his sentence incorrectly when DOC failed to credit him for time he served from May 1, 1996 to January 7, 1998, toward his new sentence of two to four years. McCray then applied for summary relief and argued that he received two separate sentences of incarceration and, unless DOC credited the time served under the initial sentence to the time to be reserved under his new sentence, the sentence would violate the Double Jeopardy Clause of the Fifth Amendment of the United States Constitution. McCray, 807 A.2d at 939-940.
For support, McCray relied on Commonwealth v. Williams, 443 Pa.Super. 479, 662 A.2d 658 (1995). In Williams, John Williams (Williams) pled guilty to attempted theft by unlawful taking and was sentenced to eleven and one-half to twenty-three months incarceration plus three years probation. Williams served the entire twenty-three months and was then placed on probation. His probation was subsequently revoked, and he was sentenced to serve three and one-half to seven years, the maximum allowed on the attempted theft charge. Williams was not credited with the twenty-three months he served. Our Pennsylvania Superior Court held that because Williams had served the entire twenty-three months on the attempted theft charge, and the three and one-half to seven year term was the maximum sentence allowed by law, to impose the additional twenty-three months would violate 18 Pa.C.S. § 1103(3)[2] which established the maximum at seven years. The Superior Court credited Williams with the twenty-three months already served as well as eight months and twenty-three days he served on a probation violation detainer. Williams, 662 A.2d at 659.
In McCray, DOC argued that Williams did not apply because McCray's prior period of incarceration and his new sentence did not exceed the maximum sentence for the crime. DOC relied on Commonwealth v. Bowser, 783 A.2d 348 (Pa.Super.2001), petition for allowance of appeal denied, 568 Pa. 733, 798 A.2d 1286 (2002). In Bowser, Richard G. Bowser (Bowser) pled guilty to receiving stolen property. He was sentenced to serve six to twenty-three months with a consecutive three year period of probation. At the time of the sentencing, Bowser had already served eleven months and nineteen days, so he was paroled forthwith. Approximately four years later, the Court of Common Pleas of Allegheny County revoked Bowser's probation due to a new criminal conviction and imposed a sentence of one to three years. Bowser moved for time credit and requested that he be given credit on the sentence of one to three years for the eleven months and nineteen days that he was incarcerated on the original sentence of six to twenty-three months. The motion was denied. Bowser, 783 A.2d at 349.
Before the Superior Court, Bowser again raised the issue that he should receive credit for the eleven months and nineteen days that he served on his original sentences. The Superior Court determined:

*981 Having received credit for the time in jail on the first component of the sentence, appellant [Bowser] did not spend the last half of the 23-month incarcerative portion of the sentence in jail. Probation began after that credit. Credit has been given once; had no credit been given he would not have been paroled in August 1994, and his probation would not have begun for some months thereafter. We see no reason to award duplicate credit in the second component of the sentence.
....
Williams does not control our case. Appellant's [Bowser] revocation sentence (one to three years), combined with the time to which he has previously been sentenced (six to 23 months), does not equal the maximum amount of time to which he can be sentenced (seven years). Accordingly, appellant's [Bowser] sentence is not illegal and Williams does not apply.
Bowser, 783 A.2d at 350. Judge Olszewski dissented and agreed with Bowser that he should receive credit for the entire period he already served. Bowser, 783 A.2d at 351-352.
In McCray, this Court granted McCray's application for summary relief in mandamus and agreed with McCray that Williams controlled:
We agree with the dissent [in Bowser] that Williams controls because 42 Pa.C.S. § 9760(2) specifies that credit shall be given for all time spent in custody under a prior sentence if a defendant is later reprosecuted and resentenced for the same offense. Even if Williams only stands for the proposition that an inmate should be credited for time served if his prior sentence and his current sentence do not exceed the maximum sentence permitted under law, McCray would be entitled to credit because the maximum sentence he could have received was 20 years on the original charge ..., and his sentence of 2-4 years plus the 23 months already served does not exceed the maximum possible sentence that could have been imposed. Because McCray served the entire 23 months for the underlying offense and did not receive any credit for that time served, he should have received credit for the 23 months served against his sentence of 2-4 years. (Citation omitted. Emphasis in original).
McCray, 807 A.2d at 942.
Here, McSpadden was originally sentenced to a term of four to twenty-three months followed by a consecutive one-year period of probation. He was released on parole on April 23, 1993. After he violated his parole, he was reincarcerated from October 8, 1993, to March 4, 1994, and again from May 28, 1994, to August 2, 1995. On September 21, 1995, McSpadden violated the terms of his probation and received a new sentence of eleven and one-half months to twenty-three months followed by a year of probation. He served time from September 21, 1995, to September 6, 1996. After violating his parole, McSpadden received a new sentence of three to ten years effective April 10, 1997. McSpadden ultimately received credit on the new sentence for the period from March 16, 1997, to April 10, 1997. McSpadden seeks credit for the time he was incarcerated under the previous sentences: December 23, 1992, to April 23, 1993; October 8, 1993, to March 4, 1994; May 28, 1994, to August 2, 1995; September 21, 1995, to September 6, 1996; and March 16, 1997, to April 10, 1997.[3]
*982 Under McCray, McSpadden is entitled to receive credit for all time spent in custody under a prior sentence when he is later reprosecuted and resentenced for the same offense.
Therefore, this Court dismisses the preliminary objections of DOC and grants McSpadden's application for summary relief and directs DOC to credit McSpadden for the following periods: December 23, 1992, to April 23, 1993; October 8, 1993, to March 4, 1994; May 28, 1994, to August 2, 1995; September 21, 1995, to September 6, 1996; and March 16, 1997, to April 10, 1997.

ORDER
AND NOW, this 17th day of March, 2005, the preliminary objection of the Department of Corrections is dismissed. It is hereby ordered that the application for summary relief of Blake McSpadden is granted.
NOTES
[1]  DOC also preliminarily objected on the basis that McSpadden improperly served the Petition. On October 12, 2004, this Court per curiam ordered McSpadden to serve the petition for review on DOC and the Pennsylvania Attorney General by October 27, 2004, or the petition would be dismissed. On October 26, 2004, McSpadden filed a certificate of service with this Court which indicated that McSpadden had complied with the October 12, 2004, order. On October 27, 2004, this Court overruled the preliminary objection relating to service.
[2]  18 Pa.C.S. § 1103(3) provides:

Except as provided in 42 Pa.C.S. § 9714 (relating to sentences for second and subsequent offenses), a person who has been convicted of a felony may be sentenced to imprisonment as follows: (3) In the case of a felony of the third degree, for a term which shall be fixed by the court at not more than seven years.
[3]  McSpadden has received credit for the period from March 16, 1997, to April 10, 1997.
