Hi, how can I make a query like this with Criteria?
Code:
select v.idEstabelecimento, v.nomeEstabelecimento,
(Sum(valorVenda) as totalVenda),
(select (sum(quantidade) from Vendas v1
where (v1.idEstabelecimento = v.idEstabelecimento
AND data between to_date('01/01/2002','dd/MM/yyyy')
AND to_date('02/01/2002','dd/MM/yyyy')))
as totalPecas
from Vendas v
where v.idEstabelecimento = 1 OR v.idEstabelecimento = 2
AND v.data between to_date('01/01/2002','dd/MM/yyyy')
AND to_date('02/01/2002','dd/MM/yyyy')))
group by v.idEstabelecimento, v.nomeEstabelecimento
order by totalVendas