C/C++教程

column ambiguously defined &oracle数据库分页语句查询中select嵌套时出错

本文主要是介绍column ambiguously defined &oracle数据库分页语句查询中select嵌套时出错,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

column ambiguously defined &oracle数据库分页语句查询中select嵌套时出错

      • 转载于 [ lev草梦的博客](http://blog.sina.com.cn/s/blog_141718efb0102xly9.html)
    • 我的补充理解

select * from(select doublefaceinform.*,company.*,rownum trid from doublefaceinform,company where doublefaceinform.comid=company.comid  and rownum <=8)where trid >5;

里边没错,嵌套外边也没错。但是这是多表查询
多表操作时,语句中的列名,不明确。

全部写成 表|表别名.字段 可避免
即:

select temp_book.* from(select doublefaceinform.douid,doublefaceinform.pushDate,company.comName,company.companyNum,company.registerBureau,company.registerDate,rownum trid from doublefaceinform,company where doublefaceinform.comid=company.comid  and rownum <=8)temp_book;

转载于 lev草梦的博客

【1】: http://blog.sina.com.cn/s/blog_141718efb0102xly9.html

我的补充理解

SELECT * from(
	select  A.*, ROWNUM RN FROM(
		select  c.*,b.*, from student b join(
			select id,name,sex,size from user_code
		) c on b.id = c.id
	)A WHERE ROUNUM <= 6
) ```WHERE RN >3

这种情况也会出现 ORA-00918: column ambiguously defined,只要把 c.* 或者 b.* 的具体字段写出来也行

SELECT * from(
	select  A.*, ROWNUM RN FROM(
		select  b.*, c.id,c.name,c.sex from student b join(
			select id,name,sex,size from user_code
		) c on b.id = c.id
	)A WHERE ROUNUM <= 6
) ```WHERE RN >3
这篇关于column ambiguously defined &oracle数据库分页语句查询中select嵌套时出错的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!