Click here to Skip to main content
15,907,328 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi to all!
I have six tables - umrf, list, mod, fun, user, rol
Fields of each table are as follows.
umrf (uid, lid)
list (lid, mid, fid, rid)
mod (mid, mname)
fun (fid, fname)
rol (rid, rname)
user (uid, uname)

given only is uid
and I have to display lid, mname, rname, fname
I also create a query for this but there are many problems in that.
[Edit]Stored Procedure from OP, removed from comments[/Edit]
SQL
create procedure proc_mrf_discription_user (@uid nvarchar (50)) 
as 
  select sec_modules.modname_vc, sec_roles.rolename_vc, sec_functions.functionname_vc 
  from sec_umrf_details 
  left join sec_mrf_details on sec_umrf_details.mrfno_int = sec_mrf_details.mrfno_int 
  left join sec_modules on sec_modules.modid_int = sec_mrf_details.modid_int 
  left join sec_roles on sec_roles.roleid_int = sec_mrf_details.roleid_int 
  left join sec_functions on sec_functions.fnid_int = sec_mrf_details.fnid_int 
  where sec_umrf_details.userid_vc = (@uid) 
  group by sec_modules.modname_vc, sec_roles.rolename_vc, sec_functions.functionname_vc
Posted
Updated 23-Aug-11 20:21pm
v3
Comments
dan!sh 24-Aug-11 2:16am    
Show the query you already have and where is it failing.

1 solution

Using JOINS should help you solve your problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900