原句:
select count(1) totalCount from (select o.courseCode, o.name ,
(select count(a.id) from apply_learn a where a.type=1 and a.courseId=o.id) ,
(select count(b.id) from apply_learn b where b.type=1 and b.status=3 and b.courseId=o.id) ,
o.updateTime from o_course o where o.status=12) tmp_count_t
这样老提示说找不到对应的3,4列名无效
经过最后的解决:
一定要加上别名,要不hibernate不认识。
select count(1) totalCount from (select o.courseCode, o.name ,
(select count(a.id) from apply_learn a where a.type=1 and a.courseId=o.id) AS totstr,
(select count(b.id) from apply_learn b where b.type=1 and b.status=3 and b.courseId=o.id) as totstr1,
o.updateTime from o_course o where o.status=12) tmp_count_t
阅读(1895) | 评论(0) | 转发(0) |