MySQL is divided into monthly tables. How does PHP do summary statistics, query, sort and pagination

  mysql, question

Demand background

Group table

Group

Chat log

A monthly schedule, such as

chat_message_2015_04

chat_message_2015_05

chat_message_2015_06

list structure

Chattime//messagetime
GroupID // groupid

Requirements description

  1. Given a time period, such as the current day/the latest 7 days/the current month/April 12, 2015 ~ June 17, 2015, count the number of message of each group in the given time period
  2. According to the counted number of message, group is sorted and paginated for output.

1、Union
2. If innodb is divided into tables, it can be processed by merge.