Click here to Skip to main content
15,919,749 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi to all

here in this code
modname_vc is my output


this is my output
null
computer
Accounts
HR
..
.
.
.
can you tell me why the first value is null
in sec_modules there is no null
SQL
procedure [dbo].[proc_modules_for_user] (@uid nvarchar (50))
as
select  distinct sec_modules.modname_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
where	
sec_umrf_details.deleted_int=0 and sec_umrf_details.userid_vc=@uid
Posted
Updated 21-Aug-11 5:32am
v3

ur Using Left Join so its displaying all data from left table and if there is no matching record in the other table then it will display Null.
 
Share this answer
 
Comments
kami124 21-Aug-11 3:56am    
so what to do now is there any other way
Have a look at Visual Representation of SQL Joins[^] from this you can see you need to use an inner join, not a left join.
 
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