1
I wonder if it is possible to create an event in the Mysql database, where every 5 minutes the database makes a query, where it returns all the order ids and based on each id I perform another query and the result of this query, insert into another table of the database.
With each id above, perform this query below by subtitling the order_id of WHERE Orders.order_id LIKE order_id for each id of the above query.
SELECT
orders.order_id,
orders.user_id,
orders.email,
products.url,
SUM(plugin_table.product_unavailable) AS product_unavailable,
SUM(plugin_table.added_to_cart) AS added_to_cart,
SUM(plugin_table.ordered) AS ordered,
SUM(plugin_table.plugin_imported) AS plugin_imported,
SUM(plugin_table.price) AS price,
SUM(plugin_table.recommendation_done) AS recommendation_done,
SUM(plugin_table.recommended_size) AS recommended_size,
SUM(plugin_table.plugin_opened) AS plugin_opened
FROM
new_intelligence.aggr_orders orders
JOIN
new_intelligence.aggr_products products
JOIN
new_intelligence.raw_plugin_usage plugin_table
FORCE INDEX
(SESSION_USER) ON plugin_table.product_id = products.product_id
WHERE orders.order_id LIKE order_id
AND plugin_table.domain = orders.domain
AND plugin_table.user_id = orders.user_id
GROUP BY products.url;
And the result of the above query insert into another table.
Edit your question and put the code you are using to try to get the solution.
– João Martins
Related: Dynamic insertion according to date and days of the week
– Sorack