Oracle counts data for 15 minutes per time period

Source: Internet
Author: User







Floor (To_char (StartTime, ' mi ')/15) *15 order by Statime ";

String sql = "Select To_char (StartTime, ' yyyy ') | | ' -' | | To_char (StartTime, ' mm ') | | ' -' | | ' +             ' to_char (StartTime, ' dd ') | | ' ' | | To_char (StartTime, ' hh24 ') | | ': ' | | "+              " floor (To_char (StartTime, ' mi ')/15) *15 statime, sum (Count) as Counts "+              " from table "+              " where StartTime <= to_date (' 2016-11-29 18:00:00 ', ' yyyy-mm-dd hh24:mi:ss ') ' +             ' GROUP by To_char (StartTime, ' YYYY ') | | ' -' | | "+              " To_char (StartTime, ' mm ') | | ' -' | | To_char (StartTime, ' dd ') | | ' ' | | "+              " To_char (StartTime, ' hh24 ') | | ': ' | | floor (TO_CHAR (StartTime, ' mi ')/15) *15 order by Statime ";

As on the SQL statement

StartTime is one of the time fields

Count is a summarized field, or count (*) counts the number of records

Table is the name of the sheet, replace it yourself

You can also change 15 to 30, 60, and so on. Number of minutes required for statistics summary

Oracle statistics for 15 minutes per time period

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.