Jagapathibabu Banoth

Jagapathibabu Banoth

  • 1.6k
  • 175
  • 15.7k

how to do innerJoin these three Table aql

Oct 12 2023 7:07 AM

--GetUserDetails
Alter PROCEDURE GetUserDetails
@MobileNo bigint,
@Password Nvarchar(100)
AS
BEGIN
SET NOCOUNT ON;


IF EXISTS (SELECT 1 FROM Users WHERE MobileNo = @MobileNo AND Password=@Password AND KycStatus = 1)
BEGIN

SELECT
U.UserID,
U.MobileNo,
U.Firstname,
U.Lastname,
U.KycStatus,
U.CratedDate,
U.Password,
R.RoleName
FROM
Users U
INNER JOIN
UserCredential C ON U.UserID = C.UserID
INNER JOIN
Roles R ON U.RoleID = R.RoleID
WHERE
U.MobileNo = @MobileNo;
END
ELSE
BEGIN

SELECT 'Error: KYC status is not valid.' AS ErrorMessage;
END
END;


Answers (2)