ORA-00918: 未明确定义列
单表查询出现:
ORA-00918: 未明确定义列
00918. 00000 - "column ambiguously defined"
查询语句如下:
select * from ( select bts0_.btsid as btsid89_,
bts0_.btsname as btsname89_,
bts0_.btstype_id as btstype3_89_,
bts0_.region_id as region4_89_,
bts0_.longitude as longitude89_,
bts0_.latitude as latitude89_,
bts0_.btsAddress as btsAddress89_,
bts0_.cellID as cellID89_,
bts0_.CI as CI89_,
bts0_.LAC as LAC89_,
bts0_.administrator as adminis11_89_,
bts0_.contact as contact89_,
bts0_.type as type89_,
bts0_.btsname_zh as btsname14_89_,
bts0_.is_synchronized as is15_89_,
bts0_.memo as memo89_,
bts0_.vindic_id as vindic17_89_,
bts0_.project_period_id as project18_89_,
bts0_.create_time as create19_89_,
bts0_.UPFATE_TIME as UPFATE20_89_,
bts0_.STATE_ID as STATE21_89_,
bts0_.STATION_ID as STATION22_89_,
bts0_.station_id as station22_89_,
bts0_.VENDOR_ID as VENDOR23_89_,
bts0_.CLASSSIFY as CLASSSIFY89_,
bts0_.IS_SHIFEN as IS25_89_,
bts0_.ZAISHAN_NUM as ZAISHAN26_89_,
bts0_.SUB_COMPANY as SUB27_89_,
bts0_.SUB_CITY as SUB28_89_,
bts0_.SUB_COUNTRY as SUB29_89_,
bts0_.BTS_IDENTIFY as BTS30_89_,
bts0_.BTS_CODE as BTS31_89_
from Bts_Info bts0_)
请问哪里出了问题?
------解决方案--------------------ambiguously的意思是有歧义的,检查下某个列名是否有冲突。
------解决方案--------------------这么低级的问题,为什么总是发生!
------解决方案--------------------意思别名重复了
------解决方案--------------------STATION22_89_ 与 station22_89_ 别名重复
------解决方案--------------------把子查询的结果拿出来,逐个的注销试试就行了
------解决方案--------------------还是四楼的眼睛犀利,我开始找了下没找到
------解决方案--------------------STATION22_89_ 、 station22_89_别名重复了。
------解决方案--------------------bts0_.STATION_ID as STATION22_89_,
bts0_.station_id as station22_89_
你这儿用了两个同样的别名,当然出问题,与你表结构本身有没有重复列没关系的。再说,你表结构也不可能有重复列啊。
而且,你这个查询写的莫名其妙,为什么要外面再做一个select * from 呢?只用括号内的不就够了么?