NutzCN Logo
问答 Sql语句,未明确定义列
发布于 2817天前 作者 qq_b96e3a4f 2249 次浏览 复制 上一个帖子 下一个帖子
标签:

日志如下


``` For example:> "SELECT COUNT(*) FROM T_JD_USER_NO WHERE 1=1" 2017-02-28 17:35:34,410 [http-8080-2] DEBUG org.nutz.dao.impl.sql.run.NutDaoExecutor - SELECT * FROM (SELECT T.*, ROWNUM RN FROM (select a.user_no,a.bdaccount,b.service_name,c.code_name,a.free_days,a.call_time,a.fun_start_date,a.cha_start_date,d.area_name,e.user_name,a.crt_time,a.user_no_id,d.area_name,e.user_name,a.crt_time,a.user_no_id from T_JD_USER_NO a inner join T_SERVICE_MAIN b on a.service_id = b.service_id inner join T_BASE_CODE c on a.user_sts = c.bas_code and c.code_kind = 7 inner join B_CITY_CODE d on a.city_code = d.area_code inner join T_USER e on a.crt_user = e.user_id) T WHERE ROWNUM <= 10) WHERE RN > 0 2017-02-28 17:35:34,435 [http-8080-2] DEBUG org.nutz.dao.impl.sql.run.NutDaoExecutor - SQLException java.sql.SQLException: ORA-00918: 未明确定义列 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)

`代码如下``
public Pagination getPage(int pageNo, JdUserNoModel jdUserNoModel, User op) {
StringBuffer sb = new StringBuffer();
sb.append("select a.user_no,a.bdaccount,b.service_name,c.code_name,a.free_days,a.call_time,a.fun_start_date,a.cha_start_date,d.area_name,e.user_name,a.crt_time,a.user_no_id,");
sb.append("(CASE WHEN USER_NO IN (select USER_NO from t_black_list where user_no is not null) THEN '是' ELSE '否' END) as sfblack,");
sb.append("(CASE WHEN USER_NO IN (select USER_NO from t_white_list where user_no is not null) THEN '是' ELSE'否'END) as sfwhite,");
sb.append("(CASE WHEN substr(USER_NO,'1','7') in (select user_no from t_filter_seg) or substr(USER_NO,'1','8') in (select user_no from t_filter_seg) or substr(USER_NO,'1','9') in (select user_no from t_filter_seg) THEN '是' ELSE'否'END) as sfpb,");
sb.append("d.area_name,e.user_name,a.crt_time,a.user_no_id ");
sb.append("from T_JD_USER_NO a inner join T_SERVICE_MAIN b on a.service_id = b.service_id ");
sb.append("inner join T_BASE_CODE c on a.user_sts = c.bas_code and c.code_kind = 7 ");
sb.append("inner join B_CITY_CODE d on a.city_code = d.area_code ");
sb.append("inner join T_USER e on a.crt_user = e.user_id");
Cnd cnd = buildQueryCnd(jdUserNoModel);
int count = dao.count(JdUserNoModel.class, cnd);
Sql sql = Sqls.create(sb.toString());
sql.setPager(dao.createPager(pageNo, SystemContext.PAGE_SIZE));
Pagination p = new Pagination(pageNo, SystemContext.PAGE_SIZE, count);
sql.setCallback(Sqls.callback.entities());
sql.setEntity(dao.getEntity(JdUserNoModel.class));
dao.execute(sql);
List list = sql.getList(JdUserNoModel.class);
p.setList(list);
return p;
}
```

3 回复

select 里面有两个 a.user_no_id

e.user_name,a.crt_time,a.user_no_id,d.area_name,e.user_name,a.crt_time,a.user_no_id 这一段好多重复的

哦,看到了,谢谢

添加回复
请先登陆
回到顶部