This is the requirement. One copy of data is post every hour and written to the data table. Now, you need to query data by month. For example, if the data is queried at, the data is all data from September 1 on January 1, 0000 to September 6 on January 1, 1100. Now there are two problems...
This is the requirement.
One copy of data is post every hour and written to the data table.
Now, you need to query data by month. For example, if the data is queried at, the data is all data from September 1 on January 1, 0000 to September 6 on January 1, 1100.
Now there are two problems.
1. How should we design data tables in this scenario?
2. How can I write an SQL statement based on a specific month, for example, January 2015?
Now, I write the hourly data to data Table A (the fields are id, time, order_count, and time are in the unix timestamp format, that is, written in php using the time () function). Then, the sum calculation of the data in Table A is written to table B every hour. Finally, the data is queried through table B.
Thank you in advance.
Reply content:
This is the requirement.
One copy of data is post every hour and written to the data table.
Now, you need to query data by month. For example, if the data is queried at, the data is all data from September 1 on January 1, 0000 to September 6 on January 1, 1100.
Now there are two problems.
1. How should we design data tables in this scenario?
2. How can I write an SQL statement based on a specific month, for example, January 2015?
Now, I write the hourly data to data Table A (the fields are id, time, order_count, and time are in the unix timestamp format, that is, written in php using the time () function). Then, the sum calculation of the data in Table A is written to table B every hour. Finally, the data is queried through table B.
Thank you in advance.
This is a relatively simple data statistics... I don't know if I need to draw a wave chart ~,
Everyone else gives you the hourly data. You do not need to collect data by hour,
You just need to save the data every hour.
The table structure is basically
Id, data, time
Data is the data value.
Time indicates the time point of the data.Hour
Timestamp, that isIgnore minutes
Queries are indexed by time.