
199 Cal.App.3d 235 (1988)
244 Cal. Rptr. 764
DAVID KNICKERBOCKER, Plaintiff and Appellant,
v.
CITY OF STOCKTON et al., Defendants and Respondents.
Docket No. C000527.
Court of Appeals of California, Third District.
March 3, 1988.
*238 COUNSEL
Steven P. Stein and Sat Karam Kaur Shalsa for Plaintiff and Appellant.
Mayall, Hurley, Knutsen, Smith & Green and John Wm. Nolan for Defendants and Respondents.
OPINION
SPARKS, J.
In this case we consider the relationship between the doctrine of exhaustion of administrative remedies and judicial review under the administrative mandamus statute. (Code Civ. Proc., § 1094.5.)
(1) (See fn. 1.) Plaintiff David Knickerbocker appeals from the order sustaining a demurrer to his second amended complaint without leave to amend.[1] He asserts his causes of action are viable. For reasons different than those advanced by the defendants and accepted by the lower court, we agree that some of the causes of action cannot be maintained. The remaining causes of action are not precluded, however, and consequently a general demurrer to the entire complaint should not have been sustained. We shall therefore reverse the lower court's order.

FACTUAL AND PROCEDURAL BACKGROUND
(2) A general demurrer admits the truth of all properly pleaded factual allegations in the complaint. (Alcorn v. Anbro Engineering, Inc. (1970) 2 Cal.3d 493, 496 [86 Cal. Rptr. 88, 468 P.2d 216].) Thus we recount our *239 assumed facts from the plaintiff's complaint in order to determine if they add up to any causes of action.[2]
Plaintiff commenced work as a police officer with the Stockton Police Department in March 1967. His performance had been consistently rated satisfactory or better in the intervening years and he had been repeatedly assured both expressly and by conduct of continued employment absent just cause for firing. In September 1984 plaintiff was fired by the city at the inducement of the individual defendants for "informing the Stockton Police Department of its deficiencies." At the time he was fired, plaintiff had attained the rank of lieutenant. He challenged his firing at a City of Stockton Civil Service Commission hearing, which  following three months of testimony  ordered him reinstated at the rank of sergeant with back pay. Plaintiff did not seek review under the administrative mandamus statute of his demotion or the civil service commission's (Commission) determination that there were grounds for disciplining him. Instead, within 100 days of the decision reinstating him at the lower rank, plaintiff filed a "claim for damages" with the City of Stockton, which was deemed rejected by operation of law on July 15, 1985. (See Gov. Code, § 905 et seq.)
The plaintiff then filed his original complaint for damages against the City of Stockton and four of its employees. Following two demurrers, the complaint crystallized its focus by the time of the second amendment to allege a violation of an implied-in-fact covenant not to fire him without good cause (Pugh v. See's Candies, Inc. (1981) 116 Cal. App.3d 311 [171 Cal. Rptr. 917]), a violation of the covenant of good faith and fair dealing implied by law in every contract which precludes either party from depriving the other of the benefits of the underlying agreement (Koehrer v. Superior Court (1986) 181 Cal. App.3d 1155, 1167-1171 [226 Cal. Rptr. 820]), a tortious firing (Tameny v. Atlantic Richfield Co. (1980) 27 Cal.3d 167, 170 [164 Cal. Rptr. 839, 610 P.2d 1330, 9 A.L.R.4th 314]) in that the defendants contravened the fundamental principles of public policy in favor of free speech contained in the First Amendment to the United States Constitution and Labor Code section 1102, an intentional interference by the individual defendants with his business relationship with the City of Stockton because they brought about his firing, and an intentional infliction of emotional distress by the individual defendants in causing him to be dismissed without good cause.
*240 The defendants demurred to this second amended complaint on the ground the plaintiff had failed to exhaust his administrative remedies by not challenging the decision of the Commission through a writ of administrative mandamus. (Code Civ. Proc., § 1094.5.) The trial court begrudgingly accepted this argument and sustained the demurrer without leave to amend.

DISCUSSION
While the scent of defect may permeate the complaint, defendants are simply barking up the wrong judicial tree. (3) Under the doctrine of exhaustion of administrative remedies, "the rule is that where an administrative remedy is provided by statute, relief must be sought from the administrative body and this remedy exhausted before the courts will act." (Abelleira v. District Court of Appeal (1941) 17 Cal.2d 280, 292 [109 P.2d 942, 132 A.L.R. 715].) The doctrine is not a matter of judicial discretion but is a fundamental rule of procedure. (17 Cal.2d at p. 293.) Consequently, "[w]hen no exception applies, the exhaustion of an administrative remedy is a jurisdictional prerequisite to resort to the courts." (County of Contra Costa v. State of California (1986) 177 Cal. App.3d 62, 73 [222 Cal. Rptr. 750].) (4a) The doctrine has absolutely no application in this case, as the judicial review of an agency determination can in no way be considered part of the administrative process which must be exhausted before a subsequent judicial action may commence.
What defendants are really asserting is that plaintiff is barred because he failed to exhaust his judicial remedies. (See 3 Witkin, Cal. Procedure (3d ed. 1985) Actions, § 247, p. 276.) This variation on the theme of exhaustion can be traced to the case principally relied upon by defendants, Westlake Community Hosp. v. Superior Court (1976) 17 Cal.3d 465 [131 Cal. Rptr. 90, 551 P.2d 410]. There the hospital staff privileges of a physican were revoked and she thereafter exhausted all of the hospital's internal remedies in an unsuccessful effort to obtain reinstatement. Then, without seeking judicial review by mandamus to compel her readmission, she sued the hospital and members of its staff and committees in tort for damages. The high court held that the doctor could not maintain her tort action because she had never challenged the hospital's decision in a judicial mandamus proceeding. (Id., at pp. 482-485.) Analogizing that case to the requirement of a successful termination in a malicious prosecution action, the court reasoned that plaintiff's tort action "is necessarily premised on an assertion that the hospital's decision to revoke plaintiff's privileges was itself erroneous and unjustified. Although a quasi-judicial decision reached by a tribunal of a private association may not be entitled to exactly the same measure of respect as a similar decision of a duly constituted public agency [citation], we believe that so long as such a quasi-judicial decision is not set aside through *241 appropriate review procedures the decision has the effect of establishing the propriety of the hospital's action. (Cf. Hollywood Circle, Inc. v. Dept. of Alcoholic Beverage Control (1961) 55 Cal.2d 728, 731-733 [13 Cal. Rptr. 104, 361 P.2d 712].) Accordingly, we conclude that plaintiff must first succeed in overturning the quasi-judicial action before pursuing her tort claim against defendants." (Id., at p. 484.)
The underpinnings of this rule of exhaustion of judicial remedies, as the court's citation to the Hollywood Circle case reveals, are buried in the doctrine of res judicata or that portion of it known as collateral estoppel and more recently as issue preclusion. In the cited case, the petitioner's liquor license was revoked by the Department of Alcoholic Beverage Control and he then filed a belated appeal to Alcoholic Beverage Control Appeals Board. The board then dismissed the appeal as untimely and petitioner challenged the dismissal in a writ proceeding. The superior court denied the writ and the Court of Appeal affirmed. Thereafter, petitioner sought unsuccessfully to reopen his appeal before the board and once again sought judicial review by way of a writ application. Applying the doctrine of res judicata, the high court held that "[t]he determination in the first mandate proceeding that the dismissal of petitioner's appeal was proper therefore bars any further inquiry into that question." (Hollywood Circle, Inc. v. Dept. of Alcoholic Beverage Control (1961) 55 Cal.2d 728 at p. 733.)
Defendants misread this requirement of exhaustion of judicial remedies as one for exhaustion of administrative remedies and argue that mandate proceedings are a jurisdictional prerequisite to filing a tort action for damages in all cases. Their citations to Witkin's treatise is not helpful to their argument. The cited passages merely recount the settled principle that where administrative remedies have not been exhausted, the courts will neither permit a judicial review of the agency's action nor an independent action to be maintained. (2 Witkin, Cal. Procedure, supra, Jurisdiction, § 69, p. 437; 3 Witkin, Cal. Procedure, supra, Actions, § 234, pp. 264-265.) But there is nothing in the treatise to suggest a writ of administrative mandamus is part of the administrative remedy and the plaintiff here exhausted his administrative remedies before the City of Stockton before he filed suit. What he failed to do was exhaust his judicial remedies. The question here is whether that failure bars his suit for damages.
Although springing from similar concerns, the two exhaustion requirements are different. Judicial exhaustion is a species of res judicata while administrative exhaustion is a fundamental rule of procedure. The first governs what may be litigated and the second the forum where the claims must first be adjudicated. One is preclusive while the other is jurisdictional. (5) The exhaustion of administrative remedies is deemed jurisdictional *242 because "[t]he administrative tribunal is created by law to adjudicate the issue sought to be presented to the court. The claim or `cause of action' is within the special jurisdiction of the administrative tribunal, and the courts may act only to review the final administrative determination. If a court allowed a suit to be maintained prior to such final determination, it would be interfering with the subject matter jurisdiction of another tribunal. Accordingly, the exhaustion of an administrative remedy has been held jurisdictional in California." (3 Witkin, Cal. Procedure, supra, § 234, p. 265, italics in original.)
(6) Res judicata, on the other hand, deals with the preclusive effects of judgments in civil proceedings. It has a dual aspect. In its primary aspect the doctrine operates as a bar to the maintenance of a second suit between the same parties on the same cause of action. Its secondary aspect comes into play in situations involving a suit, not necessarily between the same parties, based upon a different cause of action. There the prior judgment is not a complete bar but it operates against the party against whom it was obtained as an estoppel or conclusive adjudication as to those issues in the second action which were actually litigated and determined in the first action. (Henn v. Henn (1980) 26 Cal.3d 323, 329-330 [161 Cal. Rptr. 502, 605 P.2d 10].) The secondary aspect is commonly referred to as collateral estoppel and is called issue preclusion by the Restatement Second of Judgments. (Rest.2d Judgments, Introduction, p. 1.) (7) The doctrine of collateral estoppel bars the relitigating of issues which were previously resolved in an administrative hearing by an agency acting in a judicial capacity. (People v. Sims (1982) 32 Cal.3d 468, 478-479 [186 Cal. Rptr. 77, 651 P.2d 321].)
Part of defendants' misapprehension springs from the remaining two cases upon which they rely. Both of these decisions speak in terms of exhaustion of administrative remedies when they mean judicial exhaustion. The first, Interior Systems, Inc. v. Del E. Webb Corp. (1981) 121 Cal. App.3d 312 [175 Cal. Rptr. 301], involved a subcontractor who refused to sign a contract submitted to it by the prime contractor of a public agency construction project. The prime contractor then sought permission to substitute a different subcontractor and the original subcontractor objected. An administrative hearing was held pursuant to statute and the prime contractor prevailed. The prime contractor then hired a new subcontractor. This prompted the original subcontractor to file an action against the prime contractor alleging that it had breached its statutory duty. The trial court sustained the prime contractor's demurrer and the appeal followed. The Court of Appeal held that where the public agency determined that the substitution was proper, the subcontractor's sole remedy was administrative mandamus pursuant to Code of Civil Procedure section 1094.5, and that a *243 cause of action for damages for breach of statutory duty was not permitted unless the decision of the awarding authority had been set aside by mandamus. In reaching this correct result, the court stated that "[e]xhaustion of administrative remedy includes application for a writ of mandamus" (id., at p. 319). In support of this assertion, the court cited Westlake Community Hospital which, as we have just noted, dealt with exhaustion of judicial remedies. Nevertheless, the Interior Systems court reached the right result and identified the proper policies underlying this variant of issue preclusion: any other result would permit a total retrial of the same facts and issues once decided and expose a respondent to possibly inconsistent rulings in different forums; furthermore, it would render the administrative hearing a meaningless and idle act if it were to be accorded no import. (Id., at pp. 319-320.)
The second case, Logan v. Southern Cal. Rapid Transit Dist. (1982) 136 Cal. App.3d 116 [185 Cal. Rptr. 878], involved an employee of a transit district who was fired. After an administrative hearing to review his discharge had been held, his termination was upheld. Believing that his due process rights were violated at the hearing, the employee brought an action against the agency alleging various tort and contract claims. The demurrer of the district was sustained and the employee appealed. The appellate court ruled, once again correctly, that "any cause of action that involves the substance of the hearing held by the RTD, whether such cause of action sounds in tort or contract, must be tested under a section 1094.5 writ. [Citation.] A plaintiff may not ignore the administrative decision by filing a separate action at law." (Id., at pp. 123-124.) The Logan court then went on to state, misleadingly we think, that the bare allegation in the employee's complaint that he "`has exhausted his administrative remedies' does not relieve him of the burden of doing so and properly pleading the results thereof." (Id., at p. 124.) In that court's view, "Logan's actions for damages against the RTD fail because he did not apply for a judicial review of the decision and findings of the administrative agency here involved pursuant to section 1094.5, which application amounts to a condition precedent to his filing a complaint for damages." (Ibid.) It would have been less misleading if the Logan court had simply explained that the determination of the administrative hearing, when unchallenged by writ, became final and thus collaterally estopped the employee from relitigating the validity of hearing or its adjudications. In this sense, the failure to overturn the administrative determination is a bar to the law suit because the disgruntled employee is bound by the adverse determination.
(4b) The same analysis applies here. Unless the administrative decision is challenged, it binds the parties on the issues litigated and if those issues are fatal to a civil suit, the plaintiff cannot state a viable cause of action.
*244 (8) "Traditionally, collateral estoppel has been found to bar relitigation of an issue decided at a previous proceeding `if (1) the issue necessarily decided at the previous [proceeding] is identical to the one which is sought to be relitigated; (2) the previous [proceeding] resulted in a final judgment on the merits; and (3) the party against whom collateral estoppel is asserted was a party or in privity with a party at the prior [proceeding].'" (People v. Sims, supra, 32 Cal.3d at p. 484, quoting People v. Taylor (1974) 12 Cal.3d 686, 691; fn. omitted.) (4c) Thus, the defendants in this case are partially correct because some of plaintiff's causes of action involve issues previously litigated and decided adversely to him. Those causes of action are barred by his failure to seek review of the Commission's determination. But it is because he never overturned the finding of the Commission that there was justification for demotion as a consequence of his actions, and not because he failed to exhaust his administrative remedies. In short, plaintiff is bound by the Commission's determination and to the extent that his causes of action are inconsistent with that determination, they are fatally flawed. But plaintiff is not required to attack an administrative determination in which he acquiesces. He is no longer an aggrieved party and need not bring a superfluous writ proceeding just to lay a foundation for a later lawsuit. If he is content to accept the results of the review process furnished by the city, nothing compels him to seek writ relief. Exhaustion of judicial relief simply means that if he wishes to attack the administrative determination he must launch that assault in an administrative mandamus proceeding and not in a lawsuit for damages.
Plaintiff's ripostes are equally unavailing. He first claims he "prevailed" at the Commission and thus could not be required to obtain judicial review of this favorable decision. Employing a variety of castigations, he rails against any system of justice which would force him to release the bird he holds in his hand (a sergeancy with back pay) in order to grab at the lieutenancy in the bush before being able to bring an independent action for his other damages. First, plaintiff's premise is wrong. On his administrative writ application, the only issue before the reviewing court would be whether the Commission abused its discretion in reducing his rank to sergeant, not whether he should have been fired. Consequently, by seeking review he would not expose himself to the risk of total defeat. Second, and most importantly, the resolution by the Commission was not a victory for plaintiff; at best, it was a draw in which the Commission implicitly did not find cause for discharge but did find cause for demotion. By failing to overturn this implicit factual resolution by the Commission, plaintiff cannot maintain his causes of action against the defendants to the extent that they are inconsistent with this resolution. This is because the Commission's resolution establishes a defense of justification for them on the face of his complaint. Thus, it does not matter (as he alternatively contends) that his *245 remedies at common law are independent of any relief the Commission might award. The question is not what damages can be awarded but what issues have been conclusively determined between the parties.
On the other hand, issue preclusion is just that; it prevents a party from relitigating an issue he fully and fairly litigated on a previous occasion. (Harman v. Mono General Hospital (1982) 131 Cal. App.3d 607, 614, fn. 3 [182 Cal. Rptr. 570].) But it is not a complete bar to the maintenance of another action between the parties. As we have noted, it operates only as an estoppel or conclusive adjudication as to those issues in the second proceeding which were actually litigated and determined in the first proceeding. (Henn v. Henn, supra, 26 Cal.3d at pp. 329-330.)
The issue that was conclusively adjudicated in the earlier administrative proceeding before the Commission was that plaintiff was properly demoted to sergeant for disciplinary reasons. That adverse determination, however, is not fatal to all of plaintiff's causes of action. Some of his causes of action, it is true, seek damages for "lost wages, salary, benefits, pension and retirement...." Since he was not wrongfully deprived of any of those benefits, he cannot state a cause of action for their recovery. But in other causes he seeks damages for "severe anxiety, worry, mental, physical and emotional distress" arising out of his improper firing. Although the defendant city and its employees had grounds for demoting plaintiff, the Commission did not find they had grounds to fire him. Thus, to the extent that plaintiff can prove that he suffered emotional distress from the improper firing as distinguished from that related to his proper demotion, nothing in the prior adjudication prevents him from doing so. (9) It may well be that plaintiff will be hard put to prove those damages, but on demurrer "the question of plaintiff's ability to prove these allegations, or the possible difficulty in making such proof does not concern the reviewing court." (Alcorn v. Anbro Engineering, Inc, supra, 2 Cal.3d at p. 496.)
(4d) In sum, the adverse determination in the civil service hearing was not fatal to all of plaintiff's causes of action. (10) It is settled that it is error to sustain a demurrer without leave to amend as to the entire complaint where the defect relates only to part of the complaint and at least one count is good.[3] (5 Witkin, Cal. Procedure, supra, Pleading, § 944, p. 379.)
*246 The judgment is reversed and the cause remanded to the lower court with directions to vacate its order sustaining the demurrer without leave to amend and issue a new and different order overruling the general demurrer.
Puglia, P.J., and Carr, J., concurred.
NOTES
[1]  An order sustaining a demurrer is not appealable; the appeal must be taken from the ensuing judgment of dismissal. (Lavine v. Jessup (1957) 48 Cal.2d 611, 614 [311 P.2d 8].) In the interest of justice and to prevent further delay, we will deem the order sustaining the defendants' demurrer to incorporate a judgment of dismissal and thus interpret plaintiff's notice of appeal as applying to such dismissal. Accordingly, the order sustaining the demurrer without leave to amend is modified by adding thereto a paragraph dismissing the action. (California State Employees' Assn. v. State of California (1973) 32 Cal. App.3d 103, 106, fn. 1 [108 Cal. Rptr. 60].)
[2]  Plaintiff filed an affidavit in opposition to the demurrer. This is entirely inappropriate, as a demurrer looks only to the face of the pleadings and to matters judicially noticeable and not to the evidence or other extrinsic matter. (Code Civ. Proc., § 430.30, subd. (a); SKF Farms v. Superior Court (1984) 153 Cal. App.3d 902, 905 [200 Cal. Rptr. 497].) The lower court gave no indication it relied in any way on the matters averred in the affidavit, and we shall eschew any reliance as well.
[3]  Both the demurrer and this appeal were based solely on the doctrine of exhaustion of administrative remedies. We therefore have no occasion to determine whether, in the context of the civil service and workers' compensation systems, there are other grounds to challenge some of the causes of action. (See, e.g., Cole v. Fair Oaks Fire Protection Dist. (1987) 43 Cal.3d 148 [233 Cal. Rptr. 308, 729 P.2d 743].) We hold only that neither the doctrine of exhaustion nor that of issue preclusion bars this case on all of its tendered theories.
