Requirements background
Group table
Group
Chat History Table
By month table, as
Chat_message_2015_04
Chat_message_2015_05
Chat_message_2015_06
Table structure
Chattime//message Time
GroupID//Group ID
Requirements Description
- Given a time period, such as the day/last 7 days/month/2015-04-12 ~ 2015-06-17, count the number of individual group's message in a given time period
- Sort and page out the group according to the number of message statistics
Reply content:
Requirements background
Group table
Group
Chat History Table
By month table, as
Chat_message_2015_04
Chat_message_2015_05
Chat_message_2015_06
Table structure
Chattime//message Time
GroupID//Group ID
Requirements Description
- Given a time period, such as the day/last 7 days/month/2015-04-12 ~ 2015-06-17, count the number of individual group's message in a given time period
- Sort and page out the group according to the number of message statistics
1.UNION
2, if InnoDB sub-table, you can use the merge processing.
Get a straight-up list of statistical data
If possible, do not use a sub-table design, table partitioning, so that the query will not need special processing. If you plan your index, performance should be fine.