mysql obtains statistical data within a specified time period Statistics by year SELECT count(*), DATE_FORMAT(order_info.create_time, '%Y-%m-%d') AS count_by_date FROM order_info WHERE DATE_FORMAT(order_info.create_time, '%Y') = '2017' GROUP BY count_by_date ORDER BY NULL Statistics by month SELECT count(*), DATE_FORMAT(order_info.create_time, '%Y-%m-%d') AS count_by_date FROM order_info WHERE DATE_FORMAT(order_info.create_time, '%Y-%m') = '2017-04' GROUP BY count_by_date ORDER BY NULL The specific transformation can be changed according to your needs Thank you for reading, I hope it can help you, thank you for your support of this site! You may also be interested in:
|
<<: js to write the carousel effect
>>: Detailed installation and use of virtuoso database under Linux system
Installing and deploying a private Docker Registr...
Nginx is used as the server, Mongo is used as the...
I plan to use C/C++ to implement basic data struc...
Use JS to implement a random roll call system for...
This article introduces the sample code of CSS3 t...
I won't go into details about how important b...
Scenario Description In a certain system, the fun...
Preface Whether it is a stand-alone lock or a dis...
This article uses examples to explain the concept...
Table of contents 1. Installation: 2. Use: 3. Bui...
Table of contents 1:mysql execution process 1.1: ...
Due to your company standards, you may only allow...
Introducing Server-U software Server-U is a very ...
The code demonstrates horizontal merging: <!DO...
Table of contents 1. Overview 2. Use docker to de...