I have a table named "trans" with this structure
# 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
This table keep growing millions of rows and every few days a have to collapse the table doing this query:
SELECT user_id,paidout,sum(amount) as amount FROM trans GROUP BY user_id,paidout
then i export the result of this query to my computer in sql format
then i empty the "trans" table and then i import to "trans" the sql file i exported from that query above.
My question is , if there is any way to make this process run automated daily?