-->
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: Calculate an average over time
PostPosted: Wed Sep 24, 2008 7:46 am 
Newbie

Joined: Wed Jul 09, 2008 7:08 am
Posts: 7
Location: Sweden
Hi,

I'm not sure hibernate can be of any assistance with this but worth asking...

Given is a table PLAN with two column (DATE PLANDATE, NUMBER VOLUME).

I'd like to calculate the average volume over a week and over a month.

"Pseudo-SQL:"

Code:
select sum(VOLUME)/count(*)
from PLAN
where PLANDATE> x and PLANDATE< y // x and y restrict to one week or one month


Now I'd like to have these two values inside the PLAN entity. So if I get a PLAN entity for a specific date I have two (transient i guess) methods like getWeekAverage and getMonthAverage...

A lot of questions in one here and night not all be doable with hibernate but any input would be appreciated!!

thanks!


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.