在字段值中显示空 [英] showing null in field values
本文介绍了在字段值中显示空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
在此代码中
modname_vc
是我的输出
这是我的输出
null
电脑
帐户
人力资源
..
.
.
.
你能告诉我为什么第一个值为null
在sec_modules
中没有null
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
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
推荐答案
ur使用向左加入后,它会显示左表中的所有数据,如果另一个表中没有匹配的记录,则它将显示Null.
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.
看看SQL联接的可视表示形式 [ ^ ],您需要使用内部联接,而不是左联接.
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.
这篇关于在字段值中显示空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文