编写HQL时遇到问题。 问题是我希望将这样的东西转移到HQL
select
tb.aca_year,
(case when tw.isfulltime = 1 then count(te) end) as fulltime,
(case when tw.isfulltime = 0 then count(te) end) as parttime
from timetable tb, teacher te, teacherworktype tw
where .............
group by tb.aca_year
................
有什么建议吗?
最诚挚的问候,
答案 0 :(得分:0)
您可以这样做:
select tb.aca_year,
sum(case when tw.isfulltime = 1 then 1 else 0 end) as fulltime,
sum(case when tw.isfulltime = 0 then 1 else 0 end) as parttime
from timetable tb, teacher te, teacherworktype tw
where .............
group by tb.aca_year ................