select distinct Nnhbh,Nnhxm,Dnhbh,Dnhxm from
(select a.nhbh Nnhbh,a.nhxm Nnhxm,b.nhbh Dnhbh,b.nhxm Dnhxm
from fxjnh a,fxjdk b)
where Nnhbh=Dnhbh and Nnhxm!=Dnhxm
什么错误
------解决思路----------------------
子查询加个别名,!=换成<>
------解决思路----------------------
select distinct Nnhbh,Nnhxm,Dnhbh,Dnhxm from
(select a.nhbh Nnhbh,a.nhxm Nnhxm,b.nhbh Dnhbh,b.nhxm Dnhxm
from fxjnh a,fxjdk b) as c
where Nnhbh=Dnhbh and Nnhxm!=Dnhxm
加上别名,sql server查询得到的表必须重新命名,oracle可以这样使用。