1、branch_ip表|ip_address_A|ip_address_B|ip_address_C|ip_address_D|mask|branch_id|usecode|
|    192     |    168     |    93      |      0     |24  |    1    |commen |
|    192     |    168     |    95      |      0     |24  |    2    |commen |
|    192     |    115     |    98      |      0     |24  |    4    |commen |
2、free_ip表
|ip_address_A|ip_address_B|ip_address_C|ip_address_D|mask|usecode|
|    169     |    178     |    85      |      0     |24  | free  |
|    114     |    168     |    77      |      0     |24  | free  |
|    150     |    115     |    101     |      0     |24  | free  |3、source_data表|scr_ip_A|scr_ip_B|scr_ip_C|scr_ip_D|dst_ip_A|dst_ip_B|dst_ip_C|dst_ip_D|flow|   effect_time     |
|  192   |  168   |  93    |    8   |   114  |  168   |   77   |   62   |  1 |2010-10-21 5-30-00 |
|  192   |  168   |  98    |    4   |   169  |  178   |   85   |   77   |  5 |2010-10-21 5-30-00 |
|  192   |  168   |  95    |    7   |   150  |  115   |   101  |   35   |  8 |2010-10-21 5-30-00 |
|  192   |  168   |  93    |    35  |   114  |  168   |   77   |   13   |  6 |2010-10-21 5-30-30 |
|  192   |  168   |  98    |    44  |   169  |  178   |   99   |   54   |  4 |2010-10-21 5-30-30 |
|  192   |  168   |  95    |    50  |   150  |  115   |   112  |   85   |  7 |2010-10-21 5-30-30 |
|  192   |  168   |  93    |    2   |   114  |  168   |   77   |   13   |  6 |2010-10-21 5-35-00 |
|  192   |  168   |  98    |    5   |   169  |  178   |   86   |   54   |  4 |2010-10-21 5-35-00 |
|  192   |  168   |  95    |    9   |   150  |  115   |   101  |   85   |  7 |2010-10-21 5-35-00 |4、flowper5表
|branch_id|flow_free|flow_nofree|flow_total|  effect_time  |
|    1    |    7    |    0      |    7     |2010-10-21 5-30|
|    2    |    8    |    7      |    15    |2010-10-21 5-30|
|    4    |    5    |    4      |    9     |2010-10-21 5-30|
|    1    |    6    |    0      |    6     |2010-10-21 5-35|
|    2    |    7    |    0      |    7     |2010-10-21 5-35|
|    4    |    0    |    4      |    4     |2010-10-21 5-35|表项大致如上,主要想在mysql中利用触发器或者存储过程,将source_data表里的源IP、目的IP、流量数据、生成时间按照branch_ip表和free_ip表的信息进行识别筛选,并汇总至flowper5表中,源IP(scr_ip),目的IP(dst_ip),数据每5分钟汇总一次,数据量较大,如果效率可以的话,可以每5分钟启动一次触发器或存储过程。由于我是新人,还对这方面不是很了解,麻烦请各位高手给出具体代码,小生万分感谢。