go ahead... be a heretic | |
PerlMonks |
OT: peak values with SQLby revdiablo (Prior) |
on Jun 04, 2004 at 23:52 UTC ( [id://361276]=perlquestion: print w/replies, xml ) | Need Help?? |
revdiablo has asked for the wisdom of the Perl Monks concerning the following question: Sorry for the off-topic question, but maybe someone here will have some ideas for me. I have a table with uptime values, updated once a day. I'd like to know how high the uptime was before each reboot, so I'd like the peak uptime values. This is easily accomplished with some perl code like the following:
I'd like to do this all in SQL, however. It's less a practical requirement than idle curiosity, but maybe I'll end up learning something useful. Here's one approach I thought might work:
But there are some problems with this:
For your information, I'm using PostgreSQL. Many of its features are compatible with Oracle, so if you have any ideas that work with Oracle, they might with PostgreSQL. Any ideas are appreciated. Update: thanks to Enlil for the suggestion, but the following won't quite do it either:
This selects the highest uptime, but I want all the peaks, not just the highest one.
Back to
Seekers of Perl Wisdom
|
|