27,579
社区成员
发帖
与我相关
我的任务
分享
String hql = "select c.* from (select process_date,record_id,amount from engine_fp " +
"where legal_entity_id=:leId) s " +
"pivot (max(amount) for process_date in([:dateFOne],[:dateFTwo])) c "+
"where c.record_id in (select id from engine_fp_record " +
"where sectionId <> 3)";
Map<String, Object> map = new HashMap<String, Object>();
map.put("leId", leId);
map.put("dateFOne", dateFOne);
map.put("dateFTwo", dateFTwo);
List<Object[]> objsList = baseHibernateDAO.findByNativeSql(hql,map);
select c.* from (select process_date,record_id,amount from engine_fp where legal_entity_id=320) s
pivot (max(amount) for process_date in([2013-04-08],[2013-04-09])) c
where c.record_id in (select id from engine_fp_record where sectionId <> 3);
这个我在数据库里执行是没问题的