CREATE VIEW $viewName AS

SELECT
    DATE(transaction_date) AS transaction_date,
    user_profile_id,
    agent_id,
    master_agent_id,
    operator_id,
    game_offering_id,
    game_provider_id,
    game_id,
    balance_category_id,
    currency_id,
    game_offering_name,
    game_provider_name,
    game_name,
    balance_category,
    currency,
    SUM(bet_amount) AS bet_amount,
    SUM(preserve_amount) AS preserve_amount,
    SUM(turn_over) AS turn_over,
    SUM(win_amount) AS win_amount,
    SUM(jackpot_amount) AS jackpot_amount,
    SUM(total_bet_count) AS total_bet_count
FROM report_bet_by_datetimes
GROUP BY
    DATE(transaction_date),
    user_profile_id,
    agent_id,
    master_agent_id,
    operator_id,
    game_offering_id,
    game_provider_id,
    game_id,
    balance_category_id,
    currency_id;