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.  [ 2 posts ] 
Author Message
 Post subject: Need help with reporting query for dates - please help
PostPosted: Tue Oct 27, 2009 2:56 am 
Regular
Regular

Joined: Tue May 12, 2009 6:08 am
Posts: 92
Hi,

I need to write a report query for dates. Unfortunately, the group by clauses are not in the database - they are dynamic and not part of a table or anything like that.

I need to group like this:
1) today
2) yesturday
3) last 3 days
4) last 7 days
5) last 30 days
6) last 90 days

The only way I know how to do this with my non-master level sql knowledge is to write separate queries... or write some kind of a custom function to do the partitioning for me, although I have to keep in mind that this must work uniformly for hsqldb and mysql.

Any tips on where to get help for this sort of query? My guess is that this one, if it's possible, will be pretty tricky.

Thanks


Top
 Profile  
 
 Post subject: Re: Need help with reporting query for dates - please help
PostPosted: Tue Oct 27, 2009 3:01 am 
Regular
Regular

Joined: Tue May 12, 2009 6:08 am
Posts: 92
Actually... it did occur to me to group by a full day... and get back up to 90 results... and then just combine those into partitions and sum them up manually. That could work :)


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

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.