我有一个名为“trans”的表,其结构为
# Name Type Collation Attributes Null Default Extra Action
1 user_id int(11) No None Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Spatial Spatial Show more actions More
2 amount decimal(16,8) No None Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Spatial Spatial Show more actions More
3 aff int(11) No 0 Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Spatial Spatial Show more actions More
4 jackpot int(11) No 0 Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Spatial Spatial Show more actions More
5 paidout int(11) No 0 Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Spatial Spatial Show more actions More
6 type int(11) No 0 Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Spatial Spatial Show more actions More
7 created timestamp No CURRENT_TIMESTAMP Change Change Drop Drop Browse distinct values Browse distinct values Primary Primary Unique Unique Index Index Spatial Spatial Show more actions More
此表继续增长数百万行,每隔几天就必须折叠执行此查询的表:
SELECT user_id,paidout,sum(amount) as amount FROM trans GROUP BY user_id,paidout
然后我以sql格式将此查询的结果导出到我的计算机
然后我清空“trans”表,然后导入到“trans”我从上面的查询导出的sql文件。
我的问题是,是否有办法让这个过程每天自动运行?