Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.55 KB | None | 0 0
  1. DROP TABLE grouped_transactions;
  2. CREATE TEMPORARY TABLE grouped_transactions AS (SELECT sender_id, recipient_id, operation_id, sum(amount_value), amount_currency_code from billing_transactions group by sender_id, recipient_id, operation_id, amount_currency_code);
  3. TRUNCATE billing_transactions;
  4. INSERT INTO billing_transactions (sender_id, recipient_id, operation_id, created_at, updated_at, amount_value, amount_currency_code)
  5.     select sender_id, recipient_id, operation_id, now(), now(), `sum(amount_value)`, amount_currency_code from grouped_transactions;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement