不是SELECTed表达式
sql语句如下:
select distinct(p.project_name) name,p.pkid pkid, p.report_year year, q.cor_name cor_name,getcityname(q.belongs_city) belongs_city,
p.apply_support_funds_num apply_funds, p.total_app_invest total_app_invest, p.invest completed_invest,
get_multi_dict_values('15', p.project_type) project_type,get_multi_dict_values('6', p.declare_type) sb_type
from ydzj_non_finan_audit_status s,ydzj_non_finan_pro_info p,ydzj_non_finan_cor_info q
where p.pkid = s.project_id and p.pkid = q.project_id and s.app_phase = '6' and s.app_status = '2'
order by p.apply_support_funds_num desc, p.completed_invest,p.total_app_invest
执行F8,报错。
把p.invest改成p.completed_invest即正确。
原因是:
如果是select * from table_name order by ...,则order by子句中的字段只要求是table_name表中有的字段即可,但select子句中出现distinct后,order by子句中的字段就
必须在select子句中出现,否则会报错。
不是SELECTed表达式的更多相关文章
- ORA-01791: 不是 SELECTed 表达式
Oracle 9i数据库,执行下面语句出现错误“ORA-01791: 不是 SELECTed 表达式”:select distinct t.name from auth_employee t orde ...
- Oracle:ORA-01791: 不是 SELECTed 表达式
项目中写hql语句 出现 ORA-01791: 不是 SELECTed 表达式问题. 语句如下: select distinct(name) where student order by numbe ...
- 错误解决--oracle中出现ORA-01791: 不是 SELECTed 表达式 错误
Oracle数据库,执行下面语句出现错误“ORA-01791: 不是 SELECTed 表达式”: select distinct t.name from auth_employee t order ...
- Oracle查询错误分析:ORA-01791:不是SELECTed表达式
表结构如下: create table HH_BOOK_GOOD ( ID VARCHAR2(32) not null, BOOKID VARCHAR2(32) not null, GOODID VA ...
- Oracle报错#“ORA-01791: 不是 SELECTed 表达式”解决方法
今天遇到一个Oracle报错,写篇博客记录一下 简单看一下下面这个sql,这也查询是没报错的 select a.area_seq, a.area_name from t_unit_area a WHE ...
- oracle 错误代码大全
oracle错误代码大全(超详细) ORA-00001: 违反唯一约束条件 (.) ORA-00017: 请求会话以设置跟踪事件 ORA-00018: 超出最大会话数 ORA-00019: 超出最 ...
- SQL 报错信息整理及解决方案(持续更新)
整理一下自己遇见过的 SQL 各种报错信息及相应解决方法,方便以后查阅,主要平台为 Oracle: ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值: 原因:插入操作时,数据大于字段 ...
- oracle错误码
ORA-00001: 违反唯一约束条件 (.) ORA-00017: 请求会话以设置跟踪事件 ORA-00018: 超出最大会话数 ORA-00019: 超出最大会话许可数 ORA-00020: 超出 ...
- oracle数据库常用SQL语句(11.29更新)
笔者日常工作中常用到的sql语句,现总结如下,留作日后查看. 1.按照两列中的最大值取 ,只取两列其中的一列 SELECT * FROM t_doc T ORDER BY GREATEST(T.Loa ...
随机推荐
- angularjs指令系统系列课程(3):替换replace,内容保留transclude,作用方式restrict
这一节我们主要看一下replace,transclude,restrict这三个参数 1.replace 可取值:bool 默认为:true 对于replace属性,设置为false表示原有指令标识不 ...
- Openfire基础
网上很多openfire相关资料,这里做下学习汇总 openfire官网:http://www.igniterealtime.org/ 可以下载openfire.spark.smack安装包及源码,安 ...
- 关于String的equals问题和StringBuilder问题
今天弄了一下String和StringBuilder,遇到了一些问题. 老规矩上代码图片: 发现stringBuilder的equals方法有问题,看了一下源码,发现stringbuilder没有重写 ...
- imadjust从用法到原理—Matlab灰度变换函数之一
imadjust从用法到原理-Matlab灰度变换函数之一 转摘网址:http://blog.sina.com.cn/s/blog_14d1511ee0102ww6s.html imadjust函数是 ...
- Android 开发如何选择轮子(转)
一个项目的开发,我们不可能一切从0做起,如果真是这样,那同样要哭瞎.因此,善于借用已经做好的 "车轮" 非常重要,如: 网络访问框架:OKHttp.retrofit.android ...
- k.APR通道特殊配置
APR/native specific configuration The following attributes are specific to the APR/native connector. ...
- JQuery中操作Css样式的方法
JQuery中操作Css样式的方法//1.获取和设置样式 $("#tow").attr("class")获取ID为tow的class属性 $("#tw ...
- git 提交代码到github错误处理
git push -u origin mastererror: The requested URL returned error: 403 Forbidden while accessing http ...
- SPSS数据分析—生存分析
生存分析是对生存时间进行统计分析的一种技术,所谓生存时间,就是指从某一时间点起到所关心的事件发生的这段时间.这里的时间不一定就是钟表日历上的时间,也有可能是其他的度量单位,比如长度单位等. 生存时间有 ...
- 项目部署到tomcat Root中后导致 WebApplicationContext 初始化两次的解决方法
上一篇文章刚说项目部署到tomcat的ROOT中,今天就发现一个问题.通过eclipse启动tomcat时候,WebApplicationContext 初始化两次: 现象: 通过eclipse控 ...