-->
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: group by Day
PostPosted: Thu Aug 19, 2004 12:54 pm 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Hi,


Hibernate version: 2.1.4

Name and version of the database you are using: Oracle 9i


I have the following query:

Code:
     select o.customer.name, o.orderDate, count(*)
     from Order o
     group by o.customer.name, o.orderDate


I need to group by date (o.orderDate), but the orderDate is a Calendar.

Code:
Result:

customer name      orderDate               qty
-----------------  ---------------------   ------------
TTT Tecnologies      10/05/2004 12:20:03      1
TTT Tecnologies      10/05/2004 14:30:40      1
TTT Tecnologies      10/05/2004 16:22:01      1
TTT Tecnologies      10/05/2004 18:00:02      1
TTT Tecnologies      11/05/2004 10:15:02      1
TTT Tecnologies      11/05/2004 12:18:40      1


The correct is:

customer name      orderDate               qty
-----------------  ---------------------   ------------
TTT Tecnologies      10/05/2004               3
TTT Tecnologies      11/05/2004               2



I have the count for Day.

How can I do this in the HQL?

thanks!!!

_________________
Tads


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.