sql server - Join 3 tables in a stored procedure -
i have 3 tables in role has number of permission resides in roledetail
table have find out permissionname, roleid, rolename, roledescription
these tables:
[role], permission, roledetail
table [role]
has these columns:
roleid, rolename, roledescription
and table permission
has these columns:
pemissionid, permissionname
while table roledetail
has these columns:
roledetailid, permissionid, roleid
i want display columns roleid, rolename, roledescription, permissionname
based on given permissionid
roledetail
table , here have far
alter procedure usp_getroledetails @proleid int begin set nocount on; select r.roleid,r.rolename,r.[description],permissionname [role]r inner join roledetail d on d.roledetailid = r.roleid inner join permission p on p.permissionid = d.permissionid r.roleid = @proleid end go
i think want this
select roleid,rolename,roledescription,permissionname roledetail inner join [role] on roledetail.roledetailid = role.roleid inner join permission on permission.pemissionid = roledetail.pemissionid
Comments
Post a Comment