
496 S.E.2d 585 (1998)
STATE of North Carolina, On Relation of ONSLOW COUNTY, Plaintiff-Appellee,
v.
Donald E. MERCER, Sr., Donald E. Mercer, Sr. d/b/a Don's Enterprises, and Cynthia R. Maynor, Defendants-Appellants.
No. COA97-277.
Court of Appeals of North Carolina.
January 20, 1998.
*586 Shipman & Associates, L.L.P. by Gary K. Shipman, Carl W. Thurman, III, and C. Wes Hodges, II, Wilmington, attorneys for plaintiff-appellee.
Lanier & Fountain by Keith E. Fountain, Jacksonville, attorney for defendant-appellant.
WYNN, Judge.
Under North Carolina law, to prevail in a plea in abatement, a defendant must show that the parties, subject matter, issues and relief sought are the same in both the present and prior actions. Clark v. Craven Regional Medical Authority, 326 N.C. 15, 21, 387 S.E.2d 168, 172 (1990). In the present actions, the State seeks to hold defendants liable for violating the public nuisances laws of Chapter 19 of the North Carolina General Statutes; however, in the three prior and still pending actions brought against defendants, the issue of liability is premised on an Onslow County adult business ordinance. For this reason, the present and prior actions differ as to subject matter, issues to be determined and relief sought; therefore, we affirm the trial court's denial of defendants' plea in abatement. We further hold that the trial court properly denied defendants' motion to dismiss on grounds of res judicata and collateral estoppel.

FACTS AND PROCEDURAL HISTORY

The Prior Pending Actions

(Mercer v. Onslow, Maynor v. Onslow, and Onslow v. Mercer)
On 14 September 1995, defendant Donald E. Mercer, owner and operator of the "Pleasure Palace," an adult entertainment establishment in Onslow County, filed the first of the prior actions in the Onslow County Superior Court. In his complaint, Mercer sought (1) a permanent injunction prohibiting Onslow County from enforcing its Ordinance to Regulate Adult Businesses and Sexually Oriented Businesses in Onslow County and (2) a determination that the ordinance was invalid and void under both the federal and state constitutions.
Upon motion of the County, the case was removed to the United States District Court for the Eastern District of North Carolina. Subsequently, Onslow County counterclaimed to permanently enjoin Mercer from *587 operating the "Pleasure Palace" in violation of Onslow County's ordinance. Thereafter, United States District Court Judge Terrence Boyle, denied both Mercer's and Onslow County's request for injunctive relief. In denying Onslow County's request, Judge Boyle concluded that the County's counterclaim was "a move of no legal significance" because it did not present the court with a separate "case or controversy."
From the Federal District Court's order denying injunctive relief, Mercer appealed to the United States Court of Appeals for the Fourth Circuit, which, in a per curiam opinion, vacated and remanded Judge Boyle's judgment with instructions that the District Court abstain from deciding the questions presented under state law but retain jurisdiction over the federal claims until such time as the parties could properly return to federal court.
On 20 September 1994, the second of the prior actions was filed against Onslow County by Cynthia R. Maynor, owner and manager of the "Doll House," another adult entertainment establishment in Onslow County. As in the first action brought against Onslow County, Maynor sought to permanently enjoin Onslow County from enforcing its ordinance and to obtain a declaration that the ordinance was invalid and void. Thereafter, both Maynor and Onslow County cross-moved for summary judgment. The trial court denied summary judgment for Maynor, granted summary judgment for Onslow County and permanently enjoined Maynor from operating the "Doll House" as a nonconforming adult business in violation of the Onslow County ordinance. Maynor's appeal of that Order remains pending before this Court.
On 5 December 1995, the third prior action was filed by Onslow County against Mercer. In its complaint, Onslow County sought injunctive relief and an order of abatement commanding Mercer to comply with the provisions of the ordinance and to cease his operation of the subject adult businesses. In response, Mercer moved to dismiss or abate on grounds that his prior action against Onslow County was still pending in Federal District Court. Superior Court Judge Louis B. Meyer agreed with him and determined that Onslow County's motion for injunctive relief was not properly before the court.

The Present Actions
The present actions were brought in the Superior Court of Onslow County by the State of North Carolina against defendants Donald E. Mercer, Sr., Donald E. Mercer, Sr. d/b/a Don's Enterprises and Cynthia R. Maynor, owners and operators of a total of seven adult businesses in Onslow County which the State contends constitute public nuisances in violation of Chapter 19 of the North General Statutes.
At the hearing on this matter, defendants moved the trial court to dismiss the action on grounds of res judicata and collateral estoppel or to have it abated due to the prior pending action brought by Mercer against Onslow County. After hearing the arguments of both parties, the trial court denied defendants' Motion to Dismiss or Abate. From that order, defendants appeal.

DISCUSSION

I.

Plea in Abatement
On appeal, defendants first contend that the trial court erred in denying their plea in abatement. They argue that the present actions should be abated because the operation of some, but not all, of the businesses at issue are also the subject of the prior pending actions to which they are partiesthe action pending in the United States District Court for the Eastern District of North Carolina (Mercer v. Onslow), and the two other actions filed in the Superior Court Division of Onslow County (Maynor v. Onslow and Onslow v. Mercer). For the reasons set forth below, we disagree.
When a prior action is pending between the same parties, affecting the same subject matter in a court within the state or the federal court having like jurisdiction, the subsequent action is wholly unnecessary and therefore, in the interest of judicial economy, should be subject to a plea in abatement. Eways v. Governor's Island, 326 N.C. 552, *588 560-61, 391 S.E.2d 182, 185 (1990) (citing McDowell v. Blythe Brothers, 236 N.C. 396, 72 S.E.2d 860 (1952); and Cameron v. Cameron, 235 N.C. 82, 68 S.E.2d 796 (1952)). "Moreover, where the prior action has been adjudicated by the trial court but is pending appeal it will continue to abate a subsequent action between the parties on substantially identical subject matter and issues." Id. In determining whether the parties and causes are the same for the purpose of abatement by reason of the pendency of the prior actions, the ordinary test is this: "Do the two actions present a substantial identity as to parties, subject matter, issues involved and relief demanded." Clark, 326 N.C. at 21, 387 S.E.2d at 172 (quoting Cameron, 235 N.C. at 85, 68 S.E.2d at 798).
Based upon the foregoing principles, we conclude that the trial court properly denied defendants' plea in abatement. While there is substantial identity between the parties to the present actions and those in the prior pending actions, the same cannot be said as to the identity of the subject matter, issues involved, and relief demanded.
The present and prior pending actions differ as to subject matter because the present actions were brought under Chapter 19 of the North Carolina General Statutes and the prior actions were brought under an Onslow County ordinance regulating adult businesses. N.C.G.S. § 19-1, entitled "What Are Nuisances Under This Chapter," provides:
(a) The erection, establishment, continuance, maintenance, use, ownership of leasing of any building or place for the purpose of assignation, prostitution, gambling, illegal possession or sale of alcoholic beverages, illegal possession or sale of narcotic drugs as defined in the North Carolina Controlled Substances Act, or illegal possession or sale of obscene or lewd matter, as defined in this Chapter, shall constitute a nuisance ...
N.C.G.S. § 19-1.2 which sets forth the "types of nuisances" prohibited by N.C.G.S. § 19-19(a), provides in pertinent part:
(6) Every place which, as a regular course of business, is used for the purposes of lewdness, assignation ... or prostitution, and every such place in or upon which acts of lewdness, assignation ... or prostitution are held or occur.
Thus, to prevail in the present nuisance actions, the State will have to establish that some form of "lewdness, assignation or prostitution," occurred in defendants' establishments. See Gilchrist v. Hurley, 48 N.C.App. 433, 269 S.E.2d 646, cert. denied, 301 N.C. 720, 274 S.E.2d 233 (1981). In contrast, to establish a violation of the county ordinance, Onslow County need only show that certain specified anatomical areas were exhibited.
Moreover, maintenance of a public nuisance under Chapter 19 can be enjoined regardless of the proximity of the nuisance to other structures, while under the Onslow County ordinance, a public nuisance can be enjoined only if that business operates in a building located within 1,000 feet of a school, residence, church or other adult business. Thus, the prior pending actions and the present actions differ with regard to the location of the forbidden activity. We therefore conclude that the prior pending actions and the present actions present substantially different subject matters.
For essentially the same reasons, the present actions and the prior pending actions also differ as to the issues presented. Again, the prior federal and state actions involve defendants' challenge to the validity of the Onslow County ordinance, a question that will not arise in the present action involving defendants' alleged violations of Chapter 19 of the North Carolina General Statutes. Also, the prior action to which Maynor is a party involves only the business known as the "Doll House". In that same vein, only five of the eight businesses involved in the action brought by Mercer are at issue in the present action brought by the State. In short, the prior and present actions differ substantially as to both the laws being challenged and the issues to be resolved.
Finally, although injunctive relief is sought in all the actions involving defendants, the relief sought in the present actions is both more extensive than the relief sought in the prior actions. In the present actions, the State seeks injunctive relief, which if granted would prohibit defendants from operating a *589 public nuisance anywhere within the State of North Carolina. In contrast, if granted, the injunctive relief sought in the prior pending actions would not extend beyond the borders of Onslow County, and would not prohibit the operation of a public nuisance unless the public was located within 1,000 feet of a school, residence, church or other adult business. Further, in the present actions, the State seeks to recover from defendants the money they received from operating their businesses, while in the prior actions, such a remedy is not available under the Onslow County ordinance.
In sum, we hold that the trial court properly determined that the prior actions pending against defendants did not abate the actions presently being brought against them. We, therefore, find no merit to this assignment of error.

II.

Res Judicata and Collateral Estoppel
Next, defendants contend that the trial court erred in denying their motion to dismiss or abate based upon the theories of res judicata and collateral estoppel. They argue that under the theory of res judicata, the dismissal with prejudice of Onslow County's counterclaim in the prior federal action bars the State from bringing the present actions. In addition, defendants contend that the doctrine of collateral estoppel also bars the State from bringing the present actions because, they argue, the issues raised in the present actions could have been raised in the prior Maynor action. We find no merit in either of defendants' arguments.
To successfully assert the doctrine of res judicata, a party must prove the following essential elements: (1) a final judgment on the merits rendered in an earlier suit; (2) an identity of causes of action in both the earlier and later suit and; (3) an identity of the parties or their privies in the two suits. Hogan v. Cone Mills Corp., 315 N.C. 127, 337 S.E.2d 477 (1985). Collateral estoppel, on the other hand, is successfully asserted when a party can show that those matters actually at issue in the later suit were the same ones which were at issue in the earlier suit and were the same matters upon which the determination in the earlier action were based. In re Wilkerson, 57 N.C.App. 63, 291 S.E.2d 182 (1982).
As to defendants' claim that the theory of res judicata precludes the State from bringing the present actions against defendants, the above principles dictate the opposite conclusion. First, there is no identity of causes of action between the prior federal action and the present ones. In the present actions, the State brings its cause of action under Chapter 19 of the North Carolina General Statutes, while in the prior federal action, the liability of defendants is contingent upon the validity and enforcement of the Onslow County ordinance.
Furthermore, despite the dismissal of the prior federal action with prejudice, there was no "final judgment on the merits" in the prior federal action which would preclude the present actions from being brought. In Shoup v. Bell & Howell Co., 872 F.2d 1178 (4th Cir.1989), our Federal Circuit Court of Appeals held that the dismissal of a claim for lack of subject matter jurisdiction does not serve to preclude a later claim from being brought against a particular party. In this case, the Federal District Court concluded that Onslow County's counterclaim against Mercer was subject to dismissal with prejudice because Onslow County's counterclaim "did not present a separate `case or controversy,' and thus did not present the Court with any issues for judgment." There being no "case or controversy" by which subject matter jurisdiction could have been properly conferred upon the federal court, we must conclude that the dismissal of the prior federal action does not serve to bar the State from bringing the present actions against defendants.
As to defendants' claim that the State is barred by the doctrine of collateral estoppel from bringing the present actions against defendants, we find it significant that under Chapter 19, Onslow County was not permitted to prosecute a nuisance action in the name of the State until 1 December 1995, more than a year after Onslow County filed its counterclaim against defendants on 18 *590 November 1994. See N.C. Gen.Stat. § 19-2.1 (1991). Consequently, Onslow County could not have brought an action to abate a public nuisance at the time the Maynor action was commenced. Given these circumstances, and the fact that the State action to which defendant Maynor is a party involves the validity of the Onslow County nuisance ordinance as it relates to the business known as the "Doll House," while in the present actions, the subject matter concerns the propriety, under Chapter 19, of seven other businesses not parties to the Maynor action, we hold that the State is not barred by the doctrine of collateral estoppel from asserting issues in the present actions not raised in the prior Maynor action.
In conclusion, the order of the trial court is,
Affirmed.
EAGLES and MARK D. MARTIN, JJ., concur.
