I'm trying to create a query along the line of
select
new ReportItem(
count(case when date - getdate() > 10 then 1 else 0 end)
count(case when date - getdate() > 20 then 1 else 0 end)
count(case when date - getdate() > 30 then 1 else 0 end)
...
)
from class
group by classid
but apparently hql doesn't support "case when" in "select", what's my alternate for queries like these, I thought about using a iif UDF but that will kill the performance, subqueries will make the hql statement very lengthly, is there any other options?
Last edited by quixotry on Thu May 26, 2005 9:12 pm, edited 1 time in total.
|