488 P.2d 105

#### Mrs. Manuel APODACA, formerly Trina Moya, et al., Plaintlffs-Appellants, v. The TOWN OF TOME LAND GRANT, a corporation, a/k/a Tome Land and Improvement Company, a corporation, a/k/a the Tome Land Grant, a community land grant, and all the Shareholders Thereof, and Horizon Corporation, a Delaware Corporation, Defendants-Appellees.

No. 9139.

Supreme Court of New Mexico.

Aug. 23, 1971.

Solomon & Roth, Santa Fe, Lorenzo E. Tapia, Albuquerque, for appellants.

Ahern, Montgomery & Albert, Albuquerque, for appellees.

OPINION

OMAN, Justice.

The trial court granted defendants’ motion to dismiss plaintiffs’ complaint, except as to plaintiff, Floyd Gurule. We reverse.

By the first cause of action of the second amended complaint, plaintiffs attacked the validity of a judgment entered in Cause No. 6492 on the docket of the District Court of Valencia County and sought a determination of their claimed rights in the common lands of the Town of Tome Land Grant, or in the proceeds from the sale of said lands. By the second and third counts of their complaint they sought equitable relief in the nature of restraining orders to prevent the distribution of the funds from the sale of the lands. This equitable relief was granted and the funds are presently in the hands of a trustee appointed for this purpose by the court.

The records in both this cause and Cause No. 6492 are before us on this appeal. In addition to the complaint in this cause, plaintiffs also filed a “Motion in Support of Special Appearance to Challenge Jurisdiction” in Cause No. 6492. The matters contained in and the relief sought by this motion are substantially the same as alleged in and sought by the first cause of action of the second amended complaint in the present suit. In fact, plaintiffs filed in both suits a common “Motion for Joinder for Purposes of Hearing” by which they sought to have the two suits joined for hearing the issues raised by the “Motion in Support of Special Appearance to Challenge Jurisdiction” filed in Cause No. 6492 and “Count I of the Second Amended Complaint filed in Cause No. 14849.” One of the grounds asserted for *56the joinder was: “That the issues and the evidence bearing thereon will be identical in most respects.” This motion is still pending.

The trial court sustained the motion to dismiss the complaint, except as to plaintiff, Floyd Gurule, upon the ground that it “constitutes a collateral attack upon the judgment in Cause No. 6492 * * The complaint as to Mr. Gurule was not dismissed because he had not been named as a party in Cause No. 6492.

We need not decide whether the trial court was correct in determining this was a collateral attack on the judgment in Cause No. 6492. The case law on this point as announced by this court does not appear to be entirely consistent in all respects. See Bowers v. Brazell, 27 N.M. 685, 205 P. 715 (1922); Barela v. Lopez, 76 N.M. 632, 417 P.2d 441 (1966). However, the later cases clearly suggest that under the definitions of direct and collateral attacks adopted therein, the present suit would fall within the definition of a collateral attack as held by the trial court. See Barela v. Lopez, supra; Lucus v. Ruckman, 59 N.M. 504, 287 P.2d 68 (1955).

However, the record shows, and it is conceded, that at least one of the named plaintiffs in the present suit, other than Mr. Gurule, was not named as a party in Cause No. 6492, and, as shown above, the complaint sought not only to have the judgment in Cause No. 6492 declared void, but sought other relief, including the equitable relief which was granted. In defendants’ “Response to Temporary Restraining Order,” the first issue- presented was “That-Plaintiffs’ Complaint does not state facts sufficient to constitute a cause of action.” This issue was apparently resolved against defendants, since the restraining order was made permanent after a hearing on the issues. For these reasons the complaint should not have been dismissed for failure to state a claim upon which relief could be granted. Generally, as to the function to be performed by a motion under Rule 12(b) (6), Rules of Civil Procedure [§ 21-1-1(12) (b) (6), N.M.S.A.1953 (Repl.Vol. 4 1970)], and the circumstances under which the motion may properly be granted, see 2A, Moore’s Federal Practice, § 12.08, at 2244 (2d ed. 1968) ; Rubenstein v. Weil, 75 N.M. 562, 408 P.2d 140 (1965); Jones v. International Union of Operating Engineers, 72 N.M. 322, 383 P.2d 571 (1963).

The order dismissing the second amended complaint should be reversed and the cause remanded with instructions to reinstate it upon the docket.

It is so ordered.

COMPTON, C. J., and MONTOYA, J., concur.