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
1. Environment Ubuntu 16.04 running on a virtual ...
RGB color table color English name RGB 16 colors ...
background In order to support Docker containeriz...
This article uses an example to describe how to v...
This article shares with you how to install the M...
Click here to return to the 123WORDPRESS.COM HTML ...
Table of contents Stabilization Throttling: Anti-...
Copy code The code is as follows: <html> &l...
This article example shares the specific code of ...
Table of contents Preface Is the interviewer aski...
Cockpit is a web-based server management tool ava...
Ping www.baidu.com unknown domain name Modify the...
1. Generally, mariadb is installed by default in ...
Use JS to implement a random roll call system for...
On a Windows server, if you want to back up datab...