This appeal involves the prior pending action doctrine. The plaintiff, who had been employed by the defendant as a teacher, instituted an administrative appeal under General Statutes § 10-151 (f)1 from the termination of her employment. *649While that action was pending, the plaintiff, seeking a writ of mandamus and a declaratory judgment, instituted a second, separate action against the same defendant. The factual allegations in both actions are substantially identical, and the trial court, finding that the “ultimate goals in both cases are not dissimilar,” granted the defendant’s motion to dismiss the later action under the prior pending action rule. The plaintiff appeals. We find no error.
The present appeal arises from our remand in Lee v. Board of Education, 181 Conn. 69, 434 A.2d 333 (1980). The plaintiff2 was a tenured teacher employed by the defendant, the city of Bristol board of education, which discharged her from that position in 1974. Thereafter, pursuant to the Teacher Tenure Act; see General Statutes § 10-151; the plaintiff appealed from that decision to the Court of Common Pleas, which dis*650missed the appeal. She then appealed to this court, and in Lee v. Board of Education, supra, we held that “a tenured teacher discharged for cause under General Statutes § 10-151 (b) is entitled, as a matter of constitutional law, to a written statement of the decision reached, the reasons for the determination, and a fair summary of the evidence relied upon.” Id., 79. Because these requirements had not been met, we set aside the trial court’s judgment and the matter was remanded “with direction to return the case to the board for further proceedings consistent with this opinion.” Id., 84.
Thereafter in November, 1980, the defendant board, comprised entirely of members who had not participated in the previous 1974 termination proceeding, “issued ‘findings and conclusions,’ based upon the record” of the plaintiff’s 1974 pretermination hearing, to substantiate the plaintiff’s discharge. On December 4, 1980, the plaintiff appealed those “actions and decision” of the defendant to the Superior Court where that action (the first action) is still pending. See General Statutes § 10-151 (f). While the first action was pending, the plaintiff also initiated this second action which forms the subject of this particular appeal before us. Although the allegations of these two complaints, except for one sentence in each,3 are identical, the prayers for relief differ somewhat. In the first action, *651the plaintiff alleged aggrievement and sought a reversal of the defendant’s “final decision,” a declaration “that the action of said Board in attempting to terminate [the] plaintiff’s contract of employment . . . [is] invalid,” and an order “that this matter be remanded to the Board for a determination of the amount of back wages and benefits owed to [the] plaintiff by [the] defendant.” The prayer for relief in the plaintiff’s second action sought both a writ of mandamus and a declaratory judgment to the effect that the plaintiff either be reinstated to her previous position as a tenured teacher or be granted a “new hearing” pursuant to General Statutes § 10-151 “to determine whether [the] plaintiff should be terminated from her position with [the] defendant as of the date of the determination resulting from that new hearing” and that the defendant also must hold a “hearing” for the purpose of determining “the amount of back wages and benefits” owed to the plaintiff by the defendant “for the period of time from her unlawful termination to the date when she is either reinstated or lawfully terminated . . . .”
Alleging lack of subject matter jurisdiction, the defendant filed a motion to dismiss the second action on the ground, inter alia, that it was “virtually identical to the one filed on December 4, 1980.” See Practice Book §§ 142,143,145. The trial court granted the defendant’s motion to dismiss and, in its memorandum of decision, stated: “The parties in both cases are the same and the allegations raised in the appeal and in the instant action are mutual. Beyond this, both matters were filed and are pending in the same jurisdiction and venue. The court is mindful that the remedy sought in the instant matter is dissimilar to that in the earlier case. This is of no significant consequence. The ultimate goals in both cases are not dissimilar.” The plaintiff appeals from this dismissal, but nevertheless *652concedes in her brief that, if the first appeal “proceeds to a final decision on the merits, this action will be unnecessary.”
“It has long been the rule that when two separate lawsuits are ‘virtually alike’ the second action is amenable to dismissal by the court. Henry F. Raab Connecticut, Inc. v. J. W. Fisher Co., 183 Conn. 108, 112, 438 A.2d 834 (1981).” Solomon v. Aberman, 196 Conn. 359, 382, 493 A.2d 193 (1985). The prior pending action doctrine has evolved as a “rule of justice and equity”;4 Hatch v. Spofford, 22 Conn. 485, 494 (1853); and retains its vitality in this state, in which “joinder of claims and of remedies is permissive rather than mandatory.” (Citations omitted.) Solomon v. Aberman, supra.
We have explicated the prior pending action doctrine as follows: “ ‘ “The pendency of a prior suit of the same character, between the same parties, brought to obtain the same end or object, is, at common law, good cause for abatement. It is so, because there cannot be any reason or necessity for bringing the second, and, therefore, it must be oppressive and vexatious.” This is “a rule of justice and equity, generally applicable, and always, where the two suits are virtually alike, and in *653the same jurisdiction.” Hatch v. Spofford, [supra, 494]; Cahill v. Cahill, 76 Conn. 542, 547, 57 Atl. 284 [1904].’ Dettenborn v. Hartford-National Bank & Trust Co., 121 Conn. 388, 392, 185 A. 82 (1936); see Zachs v. Public Utilities Commission, 171 Conn. 387, 391-92, 370 A.2d 984 (1976). ‘The rule forbidding the second action is not, however, one “of unbending rigor, nor of universal application, nor a principle of absolute law . . . .” Hatch v. Spofford, [supra].’ Farley-Harvey Co. v. Madden, 105 Conn. 679, 682, 136 A. 586 (1927); see Brochin v. Connecticut Importing Co., 137 Conn. 350, 352, 77 A.2d 336 (1950); Dettenborn v. Hartford-National Bank & Trust Co., supra, 393.” Henry F. Raab Connecticut, Inc. v. J. W. Fisher Co., supra, 112-13. We must examine the pleadings to ascertain whether the actions are “virtually alike.” See Solomon v. Aberman, supra, 383.
The allegations contained in the plaintiff’s complaints in both actions are identical, and, as we have already explained, the actions arise from the same factual background. Therefore, although we have recognized that “[t]he fact that the damages sought by the plaintiff in these two cases may overlap is not dispositive”; Solomon v. Aberman, supra, 385; it is necessary in this case to analyze the prayers for relief in these two complaints in order to ascertain the “ends or objects” of these two actions.
In the first action, the administrative appeal taken pursuant to § 10-151 (f), the plaintiff is seeking a determination from the trial court that the defendant’s “final decision” be reversed, that the defendant’s attempt to terminate her “be declared invalid and of no effect,” and that the matter be remanded to the defendant for the purpose of determining the amount of back pay and benefits the plaintiff should receive. In the second action, which is the subject of this appeal, the plaintiff seeks both a writ of mandamus and a declaratory judg*654ment to the effect that the plaintiff either be reinstated to her former position as a tenured teacher or be granted a “new hearing” by the defendant and that the defendant be ordered to hold a hearing on the amount of back pay and benefits she should receive. As the trial court correctly observed, the result of the second action “would be mutual to the relief sought in the administrative appeal [first action]. ...”
We have recently said that “[m]andamus is an extraordinary remedy, designed to enforce a plain, positive duty and available only to one who has a clear legal right to performance of that duty. Cheshire Taxpayers’ Action Committee, Inc. v. Guilford, 193 Conn. 1, 5, 474 A.2d 97 (1984).” Simons v. Canty, 195 Conn. 524, 533, 488 A.2d 1267 (1985). It is obvious that if this plaintiff could establish as a necessary threshold requirement to the issuance of the writ the “clear legal right” to the relief she has requested, that right could also be established, as well as vindicated, on her § 10-151 appeal.5 Moreover, the request for a declaratory judgment would require the trial court “to ascertain the *655rights of the parties under existing law.” (Citations omitted.) Middlebury v. Steinmann, 189 Conn. 710, 715, 458 A.2d 393 (1983). In both the first action and the second action then, the plaintiff would be required to establish her right to an order from the court granting the relief requested, which in the two cases is ultimately the same: reinstatement or a new hearing and back pay and benefits. “[T]he fact that different relief is sought does not prevent [dismissal] of a second action adjudicating the same underlying rights. ” (Emphasis added.) 1 Stephenson, Conn. Civ. Proc. (2d Ed.) § 104b, p. 423.
In sum, the “same underlying rights,” i.e., rights to reinstatement, new hearing, back pay and benefits, which the plaintiff asserted in the second action would be adjudicated and necessarily determined in the prior pending action. See Zachs v. Public Utilities Commission, supra, 393; Cahill v. Cahill, 76 Conn. 542, 548, 57 A. 284 (1904). This the plaintiff has correctly conceded, and in this court she has presented neither claim nor argument that any remedy that could be accorded her in the prior pending action would be inadequate or incomplete. See Welles v. Rhodes, 59 Conn. 498, 504, 22 A. 286 (1890). Therefore, the trial court correctly dismissed the second action.
There is no error.
In this opinion the other judges concurred.
General Statutes § 10-151 (f) provides: “Any teacher aggrieved by the decision of a board of education or board of trustees of an incorporated or endowed high school or academy approved pursuant to section 10-84 *649after a hearing as provided in subsection (b) of this section may appeal therefrom, within thirty days of such decision, to the superior court for the judicial district in which such board or such high school or academy is located. Such appeal shall be made returnable to said court in the same manner as is prescribed for civil actions brought to said court. Any such appeal shall be a privileged case to be heard by the court as soon after the return day as is practicable. The board of education or the board of trustees of the incorporated or endowed high school or academy shall file with the court a copy of the complete transcript of the proceedings of the hearing held by the board of education or board of trustees of the incorporated or endowed high school or academy or by an impartial hearing panel for such teacher, together with such other documents, or certified copies thereof, as shall constitute the record of the case appealed from. The court, upon such appeal, shall review the proceedings of such hearing and shall allow any party to such appeal to introduce evidence in addition to the contents of such transcript, if it appears to the court that additional testimony is necessary for the equitable disposition of the appeal. The court, upon such appeal and after a hearing thereon, may affirm or reverse the decision appealed from. Costs shall not be allowed against the board of education or board of trustees of the incorporated or endowed high school or academy unless it appears to the court that it acted with gross negligence or in bad faith or with malice in making the decision appealed from.”
The plaintiff in the present appeal, Mrs. Elinor Halpern, is the former Elinor Lee.
The first twenty enumerated paragraphs of the two separate complaints are identical, except that the complaint in the first action omits a reference to the date of our decision in Lee v. Board of Education, 181 Conn. 69, 434 A.2d 333 (1980). The twenty-first paragraph in each complaint, as well as some of the language in the prayer for relief as enunciated in the text, differs.
In the direct appeal filed by the plaintiff pursuant to General Statutes § 10-151 (f), the plaintiff alleges: “21. The plaintiff is aggrieved by the defendant board’s actions and decision.”
In the present action, the plaintiff alleges in the twenty-first paragraph of her complaint: “21. Since August 30,1974, defendant has refused to pay plaintiff any of the wages and benefits to which she would be entitled as a tenured teacher, and the plaintiff is aggrieved by the defendant’s actions.”
We have recognized that the prior pending action rule does not truly implicate the subject matter jurisdiction of the court. Henry F. Raab Connecticut, Inc. v. J. W. Fisher Co., 183 Conn. 108, 111-12, 438 A.2d 834 (1981); see also Nielsen v. Nielsen, 3 Conn. App. 679, 682, 491 A.2d 1112 (1985). Any claim “that the pendency of a prior suit between the same parties, for the same thing, will abate a latter suit”; Quinebaug Bank v. Tarbox, 20 Conn. 509, 514 (1850); formerly could be raised by a “plea in abatement.” See, e.g., Zachs v. Public Utilities Commission, 171 Conn. 387, 370 A.2d 984 (1976); Ward v. Curtiss, 18 Conn. 290 (1847); Durand v. Carrington, 1 Root 355 (1792). The plea in abatement; Practice Book, 1963, § 93; has, however, since been replaced by the motion to dismiss. Practice Book §§ 142,143; 1 Stephenson, Conn. Civ. Proc. (2d Ed. 1982 Sup.) § 103a. The parties in the present case properly proceeded upon the assumption then that the motion to dismiss was the proper device by which to request that the trial court dismiss the second action. 1 Stephenson, supra, § 104a; see also Hannafin v. Ethics Commission, 39 Conn. Sup. 99,102, 470 A.2d 720 (1984).
We have often stated that we generally review an appeal upon the theory under which it was tried and adjudicated in the court below. See, e.g., Fuessenich v. DiNardo, 195 Conn. 144, 151, 487 A.2d 514 (1985). Because the plaintiff is now effectively “out of court” on the second action, we are not required here to consider any potential implications of our recent decisions in Laurel Park, Inc. v. Pac, 194 Conn. 677, 485 A.2d 1272 (1984), and Juliano v. Farrell, 196 Conn. 283, 492 A.2d 187 (1985). In those cases we indicated that the availability of an administrative appeal to provide the same relief as that sought in an action for an injunction or for a writ of mandamus barred resort to those remedies. “We have frequently stated that when a party has a statutory right of appeal from the decision of an administrative agency, he may not, instead of appealing, bring an independent action to test the very issue which the appeal was designed to test.” (Citations omitted.) Carpenter v. Planning & Zoning Commission, 176 Conn. 581, 598, 409 A.2d 1029 (1979). The application of these principles to the present action seeking a declaratory judgment and a writ of mandamus might also support the judgment of dismissal. Because neither the parties nor the trial court have discussed this alternative ground for affirmance, however, we have decided to rely wholly upon the prior pending action doctrine, the only ground considered by the parties or the trial court.