Query the four tables aspnet_membership, aspnet_users, users, and userroles.
1. Do not use inner join for four table join queries
Declare @ username nvarchar (100) <br/> declare @ userpwd nvarchar (100) <br/> set @ username = 'admin' <br/> set @ userpwd = 'Password' <br/> select * From aspnet_membership AM, aspnet_users Au, users U, userroles ur where am. userid = au. userid and <br/> au. username = u. username and U. userid = Ur. userid <br/> and U. username = @ username and AM. password = @ userpwd and Ur. roleid = 0
2. Join a four-table join query using inner
Declare @ username nvarchar (100) <br/> declare @ userpwd nvarchar (100) <br/> set @ username = 'admin' <br/> set @ userpwd = 'Password' <br/> select * from (aspnet_membership inner join aspnet_users on aspnet_membership.userid = aspnet_users.userid) <br/> Inner join users on aspnet_users.username = users. username) Inner join userroles on users. userid = userroles. userid) <br/> where users. username = @ username and aspnet_membership.password = @ userpwd and userroles. roleid = 0
The preceding query statement can be used to query the results of the specified username and password with the role roleid = 0.