select pn.pay_Notice_Id,c.client_Shortcut,con.contract_Name,pn.notice_Date,u.user_Truename,pn.father_Pay_Notice_Id,pn.receipt_Date
from Pay_Notice pn,Con_Client_Emp cce,Client c,[User] u,Contract con
where cce.cce_Id=pn.cce_Id and
cce.customer_Service_Id=8 and pn.receipt_Flag=2
and c.client_Id=cce.client_Id and con.contract_Id=pn.contract_Id
and u.user_Id=cce.customer_Service_Id
and ( pn.receipt_Remind !=1 or pn.receipt_Remind is null )
order by pn.pay_Notice_Id desc
这个contract_Name字段 有的为空 怎么把它查询出来
from Pay_Notice pn,Con_Client_Emp cce,Client c,[User] u,Contract con
where cce.cce_Id=pn.cce_Id and
cce.customer_Service_Id=8 and pn.receipt_Flag=2
and c.client_Id=cce.client_Id and con.contract_Id=pn.contract_Id
and u.user_Id=cce.customer_Service_Id
and ( pn.receipt_Remind !=1 or pn.receipt_Remind is null )
order by pn.pay_Notice_Id desc
这个contract_Name字段 有的为空 怎么把它查询出来
查询用楼上的,如果想在列中不显示NULL,可以用 isnull(contract_Name ,'')
pn.*,
cont.contract_Code,
cont.contract_Name,
u.user_Code,
u.user_Truename,
client.client_SHORTCUT client_Name,
client.client_Id,
client.client_Type,
'' as employee_Name,
0 as employee_Id
from
Pay_Notice pn
left join
con_Client_Emp cce
on pn.CCE_ID=cce.CCE_ID
left join
client client
on cce.client_id=client.client_id
left join
contract cont
on pn.contract_Id=cont.contract_id
left join
[user] u
on pn.CUSTOMER_SERVICE_ID=u.USER_ID
where
pn.receipt_Remind=0
and pn.customer_Service_Id=8
and pn.father_Pay_Notice_Id=0
and pn.receipt_Flag=2
and pn.CLIENT_AFFIRM=1
and pn.excel_Flag=0 这个就能查出 字段为空白的 为什么上一个就不能呢??
至于在查到的记录集中,contract_Name 看不到,那也许它就是空串.
你说的查不到,是这个列没有值,还是查不到记录?如果是查不到记录,那要检查查询条件,如果只是这一列查不到值,那就是它本身就是空串.
建议用
select * from contract
where contract_Name is null or contract_Name=''
检查一下你表中的数据.