例如

select * from tbl_a a

left join tbl_b b on b.docno=a.docno and b.project=a.project

where a.docno='xxx'

发现a的project列和b的project列都为 null

于是匹配不到值

最后改为:

select * from tbl_a a

left join tbl_b b on b.docno=a.docno and isnull(b.project,0)=isnull(a.project,0)

where a.docno='xxx'

即可

05-11 15:09