因为我SQL里有用到oracle的 row_number() 函数,整个SQL如下:
select *
from (select t.*,
row_number() OVER(PARTITION BY t.fd_write_dept ORDER BY t.fd_create_time desc) row_flag
from finance_budget t
where 0 = 0
) rs
where rs.row_flag = 1
用row_number的目的是想查相同fd_write_dept的最新的数据,又想用分页,所以就用了Db.paginate,运行的时候,就报异常
java.sql.SQLException: ORA-30485: 在窗口说明中丢失 ORDER BY 表达式
看jfinal打印出来的SQL就是变成了如下
select count(*) from (select t.*,
row_number() OVER(PARTITION BY t.fd_write_dept ) row_flag
from finance_budget t
where 0 = 0
) rs
where rs.row_flag = 1
就是把order by 去掉了,怎么办呢这是,有些子查询里的order by 是对结果有影响的,不应该为了count,而把里面所有的order by 都去掉吧
项目:JFinal