dbTalk Databases Forums  

Re: sql for retrieving statistic

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Re: sql for retrieving statistic in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Billy Verreynne
 
Posts: n/a

Default Re: sql for retrieving statistic - 07-17-2003 , 06:56 AM






mago22 (AT) hotmail (DOT) com (maria granholm) wrote

Quote:
I have a database collecting alarms. now I want to get statistic from
the last month. and I want the average alarms to be presented per hour
and after severity.
snipped

To display data for an hour for which you do not have data.. I suggest
a fixed table called HOUR, that is populated with 24 rows - one for
each hour.

You can then outer join your stats table to this hour table and output
data for hours where there are no alarms.

You can also expand this table to a TIME table that contains a row for
every second of the day. Same principle applies, but allows you a much
finer grain than a HOUR table.

Quote:
and is it also possible to display a Sum after each hour?
Look at the GROUP BY and ROLLUP clauses in the SQL Reference Manual.
There are examples given too (in your case you will do something like
a "group by rollup(hour)" as the aggregation clause for your query).


--
Billy


Reply With Quote
  #2  
Old   
Robert A.M. van Lopik
 
Posts: n/a

Default Re: sql for retrieving statistic - 07-17-2003 , 03:10 PM







"Sybrand Bakker" <gooiditweg (AT) sybrandb (DOT) demon.nl> wrote

< snip >

Quote:
Had too much coffee? Why on earth are you answering homework? Or has
your job being taken over by Indians?

Your last remark is both off-topic and has a nasty racist tone. You had
better stick to what you're good at: Oracle technicalities.

met vriendelijke groeten

rob van lopik


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 16-7-2003




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.