"MySQl" by all, today, this month, 24 hours per hour statistics

Source: Internet
Author: User

--24 hours
SELECTHOUR (create_date) ashours,SUM(Source_amount) Sm_source_amount,SUM(Ticket_count*Purchase_price) asSm_purchase_amount fromTicket_orderWHEREdate_format (Create_date,'%y-%m-%d')= '2017-05-12' andscenic_idinch(1,2,3);GROUP byHOUR (create_date);SelectHour (create_date) asHours,ticket_count,create_date fromTicket_orderwhereDate_format (Create_date,'%y-%m-%d')= '2017-05-12' Group byhour (create_date);--DaysSELECT SUM(Source_amount) asSm_source_amount,SUM(Ticket_count) asSm_ticket_count fromTicket_orderWHEREdate_format (Create_date,'%y-%m-%d')= '2017-05-17';--monthSELECT SUM(Source_amount) asSm_source_amount,SUM(Ticket_count) asSm_ticket_count fromTicket_orderWHEREdate_format (Create_date,'%y-%m')= '2017-05';--AllSELECT SUM(Source_amount) asSm_source_amount,SUM(Ticket_count) asSm_ticket_count fromTicket_order;

"MySQl" by all, today, this month, 24 hours per hour statistics

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.