HQL - problemas com uma sub query

0 respostas
L

Olá.

Eu tenho a seguinte query em SQL:

select c1.code, count(*) from (select min(myDate) as myDate,serialNumber,code from TableXpto where actual_state ='OK' group by serialNumber) as c1 where c1.myDate >= '2009-01-01' and c1.myDate <= '2010-03-20' group by c1.code

e queria converter para HQL.

Já tentei algo assim:

select c1.code, count(c1.id) from TableXpto c1 where c1.myDate>='2009-01-01' and c1.myDate<='2010-03-20' and c1.myDate exists ( select min(c1.myDate) ,c1.serialNumber,c1.code from c1 where c1.actual_state='OK' group by c1.serialNumber ) group by c1.code

mas não funciona.

Esta operação é feita sobre só uma tabela…

Criado 8 de março de 2010
Respostas 0
Participantes 1