-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Select in select with Criteria
PostPosted: Tue Jun 17, 2008 9:27 am 
Newbie

Joined: Tue Jun 17, 2008 9:18 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.