当前位置: 代码迷 >> Sql Server >> sql 话语,小白
  详细解决方案

sql 话语,小白

热度:60   发布时间:2016-04-24 10:00:00.0
sql 语句,小白
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)
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可以这样使用。
  相关解决方案