An order was issued by this court requiring that the Kings County Superior Court show cause why further proceedings in the action pending therein entitled “Ro scoe Moss Company, a California Corporation, vs. C. Ray Robinson et al.,” No. 15325, should not be stayed by a writ of prohibition.
The petitioners, C. Ray Robinson, Hugh Bennett, George W. Nickel, Jr., individually and doing business as Kern River Delta Farms, allege that on May 29, 1961, they filed a declaratory relief suit in the Superior Court of Merced County and served Roscoe Moss Company, the real party in interest herein, with a copy of complaint and summons on June 9, 1961; that in that ease the court is asked to determine the respective rights and obligations of the plaintiffs and numerous defendants arising out of written agreements for the drilling of two water wells on property of petitioners in Kings County. The contract which constitutes Exhibit A attached to a copy of the complaint in the Merced action was executed February 13, 1961, between Kern River Delta Farms and Knapp & Graham, Inc.; the latter agreed to drill one gravel packed, sand-free water well on the land owned by petitioners. The second agreement, Exhibit B attached to the Merced County complaint, provides for the drilling of a second well, “. . . under the same terms and conditions as set forth in the previous well drilling agreement. . . .” It will be noted that Roscoe Moss Company is not a party signatory to either of the two contracts above referred to, but it is alleged that it was a joint venturer with Knapp & Graham in the drilling of the wells and as such was an undisclosed party. The Merced County complaint alleges that all other defendants “. . . claim to be entitled to payment from plaintiffs for work, labor and materials furnished and supplied in the drilling of said well” but that such other defendants are entitled to payment only from Knapp & Graham, Inc., and Roscoe Moss Company.
The petition further avers that Roscoe Moss Company filed an action in the Superior Court of Kings County on July 20, 1961, to foreclose a materialman’s lien on the property of petitioners located in that county, and that service of the complaint and summons was not obtained therein until September 12, 1961. Petitioners further allege: “The basis for the suit in Kings County is the furnishing of materials for the construction and drilling of the same two water wells, i.e., wells numbered 12 and 13, which are involved in the dispute in Merced County. ”
*266 The petition continues by stating that Roscoe Moss Company filed a cross-complaint against petitioners in the Merced suit “. . . whereby it seeks to foreclose the same lien as is set forth in its Kings County action”; that the Merced County action is at issue and set for pretrial conference; that petitioners filed a demurrer to the complaint in the Kings County action on the ground that there was another action pending and that the demurrer was overruled and the petitioners were allowed 15 days after notice in which to answer the Kings County complaint; that petitioners subsequently filed an answer and cross-complaint in the Kings County suit and that Roscoe Moss Company, plaintiff in that action, has filed a notice of motion to advance the trial date in the Kings County action; petitioners claim that unless this court acts to stay the last named suit there will be two actions pending in the two counties seeking the same relief.
The real party in interest resists the application, claiming that the Kings County court has sole jurisdiction to try the mechanic’s lien suit commenced by it; that the Roscoe Moss Company has unsuccessfully moved to change the venue of the Merced suit to Kings County; that the contracts sued upon in Merced County and in Kings County are separate and distinct; that the Kings County action involves a total of four parties, and the Merced County action ten parties; that the real party in interest only filed a cross-complaint in the Merced County action to prevent any possibility of a determination of the issues as res judicata and that its objection to the right of the Merced County court to hear the suit for the foreclosure of the mechanic’s lien is incorporated in the cross-complaint. The complaint for the foreclosure of the lien, which is an exhibit attached to the petition, shows that the plaintiff, Roscoe Moss Company, is a California corporation with all necessary licenses issued by the State of California; that plaintiff on or about the 20th day of March, 1961, at the special instance and request of defendants (the petitioners herein), did furnish and deliver water well casing material for the construction of two wells, amounting in value to the sum of $18,214.93, which defendants promised and agreed to pay; that the materials were furnished to be used in and about the improvement of well sites on the described property in Kings County, and that the Roscoe Moss Company on the 27th day of April, 1961, caused to be recorded in the office of the County Recorder of Kings County its claim of lien against the described real property. Judgment is prayed in the Kings *267 County action in the sum of $18,214.93, together with interest thereon at the rate of 7 per cent per annum from March 20, 1961, for $5.60 for verification and recordation of the claim of lien and for $4,800 attorney’s fees.
When superior courts have concurrent jurisdiction over the same parties and subject matter in actions instituted in each of two counties, the court in which jurisdiction of the person is first obtained is entitled to try the cause, and a writ of prohibition may properly be issued to suspend action in the second court until the final decision of the case in the first.
(Greene
v.
Superior Court,
“One reason for the rule is to avoid unseemly conflict between courts that might arise if they were free to make contradictory decisions or awards at the same time or relating to the same controversy; another reason is to protect litigants from the expense and harassment of multiple litigation.”
(Scott
v.
Industrial Acc. Com.,
Service of the summons and a copy of the complaint is the test of priority of jurisdiction where there are actions in two courts dealing with the same subject matter.
(Southern Pac. Co.
v.
Superior Court,
However, a basic requirement for invoking these rules is that the courts of the two counties shall have concurrent jurisdiction. And we find that Merced County and Kings County do not have concurrent jurisdiction of this entire controversy, for article VI, section 5, of the California Constitution provides that: “. . . all actions . . . for the enforcement of liens upon real estate, shall be commenced in the county in which the real estate, or any part thereof, affected by such action or actions, is situated. ’ ’
This requirement is jurisdictional and cannot be waived. If a suit for the foreclosure of a mechanic’s or materialman’s lien is filed in a county other than that in which the land is located, the suit must be dismissed.
(Rice
v.
Schubert,
Kings County is the only county in the state in which an action to foreclose the mechanic’s lien could legally be commenced. If a suit solely for that purpose had been filed by Roscoe Moss Company in Merced County, the court would be wholly without jurisdiction; there could be no waiver by stipulation or otherwise of the constitutional requirement, and any judgment which might be rendered would be absolutely void. The same observation applies to the cross-complaint for the foreclosure of the lien; the Merced court could not foreclose the lien in Kings County.
In
Vaughan
v.
Roberts,
“In construing article VI, section 5 of the Constitution, and section 392 of the Code of Civil Procedure, the reviewing courts of California have frequently determined that an action is transitory and that the court of the county where the defendants, or some of them, reside, has jurisdiction to try the cause when the suit for possession of real property, or to quiet title thereto, or to enforce liens thereon, is joined in good faith with another cause involving personal obligations. [Citing cases.] When a transitory action is joined with a suit involving real property, and it appears, from a consideration of the pleadings as a whole, that the principal cause stated in the complaint is transitory, the action involving real property being merely incidental thereto, the court of the county where the defendants reside has jurisdiction to try the case.
(Blackman
v.
Sherman,
“ ‘An action . . . does not arise from any injury to real property, but is transitory, , , , [if it seeks] to compel sur *269 render for cancellation of a note and real estate mortgage securing it. In fact, it may be said generally that if the right to land is an incident in an action personal, it may be tried’ in the county in which the defendants or some of them reside.” (See also Weygandt v. Larson,130 Cal.App. 304 , 308 [19 P.2d 852 ]; Robinson v. Nelle,10 Cal.App.2d 541 , 543 [52 P.2d 519 ]; Eckstrand v. Wilshusen,217 Cal. 380 [18 P.2d 391 ].)
The two cases principally relied upon by the petitioners,
Myers
v.
Superior Court, supra,
“The circumstances that the action filed in the respondent court in Calaveras County was one to try title did not give said court exclusive jurisdiction over the subject matter thereof. It is well settled that section 5 of article YI of the Constitution dealing with the place for commencing certain kinds of actions pertaining to real estate, and section 392 of the Code of Civil Procedure dealing with the proper place for trying such actions, do not apply where the subject matter of the action is essentially transitory
(Neet
v.
Holmes,
“In the present case, the subject matter of both actions is
*270
of an essentially transitory and personal nature—the one, an action to quiet title to personal as well as real property
(Maguire
v.
Cunningham, supra
[
In
Cade
v.
Superior Court, supra,
The Myers and Cade eases do not support the contention of petitioners, because the action brought in Kings County is exclusively for the foreclosure of a materialman’s lien.
There are other reasons why a writ of prohibition should not issue as prayed. Generally speaking, where two courts in separate counties have concurrent jurisdiction of the subject matter, in order to justify a restraint of the second action, the parties in the two actions should be the same, the subject matter of the two suits approximately identical, and the situation such that a judgment in the first case would constitute an adjudication of the rights of the parties which could be pleaded as res judicata in the second.
In the present situation, there are seven defendants in the Merced County case and only three defendants (specifically named) in the Kings County suit. While the parties in the two actions need not be completely identical if the court has jurisdiction to bring in all of the other parties
(Slinack
v.
Superior Court, supra,
The remedies sought by the two actions contemplated by the rule need not be precisely the same
(Milani
v.
Superior Court,
The subject matter of the two cases is similarly diverse. The written contract upon which the Kings County plaintiffs place their reliance is a “Customer’s Order Form” which relates solely to the materials allegedly furnished for the wells, including casing, shutter screen perforations, a landing clamp, landing beams, and timber. This agreement is not even referred to in the complaint in the Merced County case, which pleads two other written contracts relating to the drilling of the wells.
Thus, there appears to be a vital difference in the parties, the subject matter, and the remedies in the two cases, and the writ of prohibition should not issue.
The application for a peremptory writ of prohibition is denied, and the temporary restraining order contained in the order to show cause is set aside.
Brown, J., and Stone, J., concurred.
