You might want to consider the last value as a peak. What if your last three values were 6,0,999? 999 wouldn't get counted as a peak because it's not higher than uptime_id +1 because it's the last uptime_id. You probably want to grab the max_id in a separate SQL call, but if you wanted to cram it all into one, you could do this:
SELECT uptime_id, uptime_value
FROM uptime AS t1
WHERE uptime_value >( SELECT uptime_value
FROM uptime
WHERE uptime_id = t1.uptime_id + 1
)
OR uptime_id = ( SELECT MAX(uptime_id) FROM uptime )
update nonsense example omitted
update 2 removed the strikeouts from the example, on second thought it isn't nonsense, it's a valid concern
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.