> For the complete documentation index, see [llms.txt](https://help.smartico.ai/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.smartico.ai/welcome/technical-guides/smartico-data-warehouse/smartico-dwh-transactional-views-pam.md). Agents can also search and read this documentation through its [MCP server](https://help.smartico.ai/welcome/~gitbook/mcp).

# Smartico DWH \ Transactional views, PAM

This page describes the transactional views that hold events reported by your platform (PAM): payments, casino, sports betting and bonuses.

The name of a view is the name of the event with the "tr\_" prefix. For example, the view **tr\_acc\_deposit\_approved** holds the event **acc\_deposit\_approved**. Read the general rules of the DWH on the [Smartico Data Warehouse (DWH)](https://help.smartico.ai/welcome/technical-guides/smartico-data-warehouse.md#transactional-tables) page first.

## Rules for all transactional views

* One row is one event. The primary key is **event\_id**.
* Every view is partitioned by **event\_time**. Always filter on it, and do not apply a function to the column in the filter.
* The views keep the events of the last 1080 days.
* A view appears in your dataset after its first event.
* Money amounts are in the player's wallet currency, unless the description says "original currency". To get the amount in the label currency, divide it by **user\_to\_label\_cur\_rate**. The player's currency is **core\_wallet\_currency** in [j\_user](https://help.smartico.ai/welcome/technical-guides/smartico-data-warehouse.md#query-for-user-profile-details).
* The tables list the standard Smartico columns. A column is empty when your platform does not send that value. Some integrations fill extra columns of their own; they are not listed here.
* Yes/No (BOOL) columns hold TRUE or are empty. Empty means false, so filter with **IS NOT TRUE** instead of **= false**.
* An event can reach Smartico later than it happened (**ingest\_time** is later than **event\_time**). When you load data daily, read a few hours of overlap and remove duplicates by **event\_id**.

{% hint style="warning" %}
**Columns marked "ID of a value"** hold a number, not the text your platform sent. For example, the payment method "CREDITCARD" is stored as a numeric ID. These values are your own, so there is no fixed list of IDs. The text of each ID is in a lookup view of your dataset, named under each view: see [Text of value IDs](#text-of-value-ids).

* Casino game name, game provider and game type, and the sport and league of a selection, join to dm\_ tables in the DWH (named under each view).
* For the payment method and sub-method of deposits as text, you can also use [r\_deposits](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.r_deposits).
* Columns of type INT64\[] hold a list of such IDs.
  {% endhint %}

Columns in every view:

| Column                     | Type      | Description                                                                                                                                                  |
| -------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| event\_time                | TIMESTAMP | Time of the event, as reported by your platform (UTC)                                                                                                        |
| ingest\_time               | TIMESTAMP | Time when the event reached Smartico                                                                                                                         |
| label\_id                  | INT64     | Label ID                                                                                                                                                     |
| user\_id                   | INT64     | Smartico user ID. Joins to [j\_user\_no\_enums](https://help.smartico.ai/welcome/technical-guides/smartico-data-warehouse.md#query-for-user-profile-details) |
| event\_id                  | INT64     | ID of the event in Smartico. Use it to remove duplicates                                                                                                     |
| user\_to\_label\_cur\_rate | NUMERIC   | Rate from the player's currency to the label currency. Amount in the label currency = amount / user\_to\_label\_cur\_rate                                    |

The tables below list the other columns of each view.

## Text of value IDs

The text of a column marked "ID of a value" is in a view of your dataset. **Joins** under each view names it for every such column:

* For most columns, a view named **lookup\_** plus the name of the column. For example, the text of **acc\_last\_deposit\_payment\_method** is in **dwh\_ext\_xxx.lookup\_acc\_last\_deposit\_payment\_method**.
* A dm\_ table for the casino game name, game provider and game type, and the sport and league of a selection. These columns have no lookup\_ view.

A lookup\_ view has two columns:

| Column | Type   | Description                  |
| ------ | ------ | ---------------------------- |
| id     | INT64  | The ID that the column holds |
| value  | STRING | The text of the ID           |

* It holds the values of your label and the values shared by all labels.
* It is in your dataset when a transactional view of your dataset has the column.
* A new value reaches the lookup view up to about an hour after it first appears. Use LEFT JOIN, so that the events of a new value stay in your totals; their text is empty until then.
* For a column of type INT64\[] (a list of IDs), use CROSS JOIN UNNEST on the column first, then join each ID.

Deposits of the last 7 days per payment method

```sql
SELECT L.value AS payment_method, COUNT(*) AS deposits
FROM dwh_ext_xxx.tr_acc_deposit_approved D
LEFT JOIN dwh_ext_xxx.lookup_acc_last_deposit_payment_method L ON L.id = D.acc_last_deposit_payment_method
WHERE D.event_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)
GROUP BY payment_method
ORDER BY deposits DESC
```

Open sport bets of the last 7 days per sport (a list of IDs)

```sql
SELECT L.value AS sport, COUNT(DISTINCT B.event_id) AS bets
FROM dwh_ext_xxx.tr_sport_bet_open B
CROSS JOIN UNNEST(B.sport_last_bet_sports) AS sport_id
LEFT JOIN dwh_ext_xxx.lookup_sport_last_bet_sports L ON L.id = sport_id
WHERE B.event_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)
GROUP BY sport
ORDER BY bets DESC
```

## Payments & Wallet (from PAM)

### dwh\_ext\_xxx.tr\_acc\_deposit\_approved

Approved deposits. One row per deposit.

**Joins:**

* acc\_last\_deposit\_payment\_method → [lookup\_acc\_last\_deposit\_payment\_method](#text-of-value-ids) (id)
* acc\_last\_deposit\_payment\_submethod → [lookup\_acc\_last\_deposit\_payment\_submethod](#text-of-value-ids) (id)
* acc\_last\_deposit\_payment\_provider → [lookup\_acc\_last\_deposit\_payment\_provider](#text-of-value-ids) (id)
* acc\_last\_deposit\_code → [lookup\_acc\_last\_deposit\_code](#text-of-value-ids) (id)
* acc\_last\_deposit\_source → [lookup\_acc\_last\_deposit\_source](#text-of-value-ids) (id)
* acc\_last\_deposit\_platform → [lookup\_acc\_last\_deposit\_platform](#text-of-value-ids) (id)
* acc\_last\_active\_currency → [lookup\_acc\_last\_active\_currency](#text-of-value-ids) (id)

| Column                                 | Type    | Description                                                                                                                                      |
| -------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| acc\_last\_transaction\_id             | STRING  | ID of the transaction in your platform                                                                                                           |
| acc\_last\_deposit\_amount             | NUMERIC | Deposit amount                                                                                                                                   |
| acc\_last\_original\_deposit\_amount   | NUMERIC | Deposit amount in its original currency, not converted to the wallet currency                                                                    |
| acc\_last\_deposit\_payment\_method    | INT64   | Payment method. ID of a value; text in lookup\_acc\_last\_deposit\_payment\_method                                                               |
| acc\_last\_deposit\_payment\_submethod | INT64   | Payment sub-method. ID of a value; text in lookup\_acc\_last\_deposit\_payment\_submethod                                                        |
| acc\_last\_deposit\_payment\_provider  | INT64   | Payment provider. ID of a value; text in lookup\_acc\_last\_deposit\_payment\_provider                                                           |
| acc\_last\_deposit\_code               | INT64   | Deposit code used with the deposit. ID of a value (text in lookup\_acc\_last\_deposit\_code); acc\_last\_deposit\_code\_str has the code as text |
| acc\_last\_deposit\_code\_str          | STRING  | Deposit code used with the deposit, as text                                                                                                      |
| acc\_last\_deposit\_source             | INT64   | Source of the deposit. ID of a value; text in lookup\_acc\_last\_deposit\_source                                                                 |
| acc\_last\_deposit\_platform           | INT64   | Platform of the deposit. ID of a value; text in lookup\_acc\_last\_deposit\_platform                                                             |
| acc\_last\_package\_id                 | STRING  | ID of the deposit package                                                                                                                        |
| acc\_deposit\_cc\_bin\_code            | STRING  | BIN code of the credit card used for the deposit                                                                                                 |
| acc\_is\_rollback                      | BOOL    | TRUE when the transaction cancels an earlier one. A rollback should carry negative amounts, so that a sum of the amounts gives the net amount    |
| core\_is\_exclude\_from\_report        | BOOL    | TRUE when your platform marked the transaction to be left out of reports                                                                         |
| acc\_utm\_value                        | STRING  | UTM marker that shows the marketing source of the transaction                                                                                    |
| acc\_last\_active\_currency            | INT64   | For players with several wallets: the currency of the active wallet. ID of a value; text in lookup\_acc\_last\_active\_currency                  |
| acc\_real\_balance                     | NUMERIC | Real money balance after the transaction, as your platform reports it                                                                            |
| acc\_bonus\_balance                    | NUMERIC | Bonus money balance after the transaction, as your platform reports it                                                                           |
| acc\_land\_balance\_real               | NUMERIC | Land-based (retail) wallet: real money balance                                                                                                   |
| acc\_land\_balance\_bonus              | NUMERIC | Land-based (retail) wallet: bonus balance                                                                                                        |
| acc\_land\_balance\_total              | NUMERIC | Land-based (retail) wallet: total balance                                                                                                        |
| acc\_gc\_last\_deposit\_amount         | NUMERIC | Sweepstakes: gold coins (GC) amount of the deposit                                                                                               |
| acc\_sc\_last\_deposit\_amount         | NUMERIC | Sweepstakes: SC coins amount of the deposit                                                                                                      |
| fin\_last\_trading\_account\_id        | NUMERIC | Trading platforms: ID of the trading account                                                                                                     |

Deposits of the previous day: count without rollbacks, and the net amount in the label currency

```sql
SELECT DATE(event_time) AS day,
       COUNTIF(acc_is_rollback IS NOT TRUE) AS deposits,
       SUM(SAFE_DIVIDE(acc_last_deposit_amount, user_to_label_cur_rate)) AS net_amount_label_currency
FROM dwh_ext_xxx.tr_acc_deposit_approved
WHERE event_time >= TIMESTAMP_TRUNC(TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY), DAY)
  AND event_time < TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), DAY)
GROUP BY day
```

### dwh\_ext\_xxx.tr\_acc\_deposit\_failed

Failed deposits. One row per failed deposit. The view has no amount of the failed deposit (only the sweepstakes coin amounts).

**Joins:**

* acc\_last\_failed\_deposit\_code → [lookup\_acc\_last\_failed\_deposit\_code](#text-of-value-ids) (id)
* acc\_last\_deposit\_payment\_method → [lookup\_acc\_last\_deposit\_payment\_method](#text-of-value-ids) (id)
* acc\_last\_deposit\_payment\_submethod → [lookup\_acc\_last\_deposit\_payment\_submethod](#text-of-value-ids) (id)
* acc\_last\_deposit\_payment\_provider → [lookup\_acc\_last\_deposit\_payment\_provider](#text-of-value-ids) (id)
* acc\_last\_deposit\_code → [lookup\_acc\_last\_deposit\_code](#text-of-value-ids) (id)
* acc\_last\_deposit\_source → [lookup\_acc\_last\_deposit\_source](#text-of-value-ids) (id)
* acc\_last\_deposit\_platform → [lookup\_acc\_last\_deposit\_platform](#text-of-value-ids) (id)

| Column                                 | Type    | Description                                                                                                                                      |
| -------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| acc\_last\_transaction\_id             | STRING  | ID of the transaction in your platform                                                                                                           |
| acc\_last\_failed\_deposit\_code       | INT64   | Code or reason of the failure. ID of a value; text in lookup\_acc\_last\_failed\_deposit\_code                                                   |
| acc\_last\_deposit\_payment\_method    | INT64   | Payment method. ID of a value; text in lookup\_acc\_last\_deposit\_payment\_method                                                               |
| acc\_last\_deposit\_payment\_submethod | INT64   | Payment sub-method. ID of a value; text in lookup\_acc\_last\_deposit\_payment\_submethod                                                        |
| acc\_last\_deposit\_payment\_provider  | INT64   | Payment provider. ID of a value; text in lookup\_acc\_last\_deposit\_payment\_provider                                                           |
| acc\_last\_deposit\_code               | INT64   | Deposit code used with the deposit. ID of a value (text in lookup\_acc\_last\_deposit\_code); acc\_last\_deposit\_code\_str has the code as text |
| acc\_last\_deposit\_code\_str          | STRING  | Deposit code used with the deposit, as text                                                                                                      |
| acc\_last\_deposit\_source             | INT64   | Source of the deposit. ID of a value; text in lookup\_acc\_last\_deposit\_source                                                                 |
| acc\_last\_deposit\_platform           | INT64   | Platform of the deposit. ID of a value; text in lookup\_acc\_last\_deposit\_platform                                                             |
| acc\_last\_failed\_package\_id         | STRING  | ID of the deposit package                                                                                                                        |
| acc\_utm\_value                        | STRING  | UTM marker that shows the marketing source of the transaction                                                                                    |
| acc\_real\_balance                     | NUMERIC | Real money balance after the transaction, as your platform reports it                                                                            |
| acc\_bonus\_balance                    | NUMERIC | Bonus money balance after the transaction, as your platform reports it                                                                           |
| acc\_land\_balance\_real               | NUMERIC | Land-based (retail) wallet: real money balance                                                                                                   |
| acc\_land\_balance\_bonus              | NUMERIC | Land-based (retail) wallet: bonus balance                                                                                                        |
| acc\_land\_balance\_total              | NUMERIC | Land-based (retail) wallet: total balance                                                                                                        |
| acc\_gc\_last\_failed\_deposit\_amount | NUMERIC | Sweepstakes: gold coins (GC) amount of the failed deposit                                                                                        |
| acc\_sc\_last\_failed\_deposit\_amount | NUMERIC | Sweepstakes: SC coins amount of the failed deposit                                                                                               |
| fin\_last\_trading\_account\_id        | NUMERIC | Trading platforms: ID of the trading account                                                                                                     |

### dwh\_ext\_xxx.tr\_acc\_withdrawal\_requested

Withdrawals requested by players. One row per request.

**Joins:**

* acc\_wd\_payment\_method → [lookup\_acc\_wd\_payment\_method](#text-of-value-ids) (id)
* acc\_wd\_payment\_sub\_method → [lookup\_acc\_wd\_payment\_sub\_method](#text-of-value-ids) (id)
* acc\_wd\_payment\_provider → [lookup\_acc\_wd\_payment\_provider](#text-of-value-ids) (id)
* acc\_wd\_platform → [lookup\_acc\_wd\_platform](#text-of-value-ids) (id)
* acc\_wd\_source → [lookup\_acc\_wd\_source](#text-of-value-ids) (id)

| Column                                  | Type    | Description                                                                                                 |
| --------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------- |
| acc\_last\_transaction\_id              | STRING  | ID of the transaction in your platform                                                                      |
| acc\_last\_withdrawal\_amount           | NUMERIC | Withdrawal amount                                                                                           |
| acc\_last\_original\_withdrawal\_amount | NUMERIC | Withdrawal amount in its original currency, not converted to the wallet currency                            |
| acc\_wd\_payment\_method                | INT64   | Payment method of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_method                   |
| acc\_wd\_payment\_sub\_method           | INT64   | Payment sub-method of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_sub\_method          |
| acc\_wd\_payment\_provider              | INT64   | Payment provider of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_provider               |
| acc\_wd\_platform                       | INT64   | Platform from which the withdrawal was made. ID of a value; text in lookup\_acc\_wd\_platform               |
| acc\_wd\_source                         | INT64   | Source of the withdrawal (for example on site or cash desk). ID of a value; text in lookup\_acc\_wd\_source |
| acc\_utm\_value                         | STRING  | UTM marker that shows the marketing source of the transaction                                               |
| acc\_real\_balance                      | NUMERIC | Real money balance after the transaction, as your platform reports it                                       |
| acc\_bonus\_balance                     | NUMERIC | Bonus money balance after the transaction, as your platform reports it                                      |
| acc\_land\_balance\_real                | NUMERIC | Land-based (retail) wallet: real money balance                                                              |
| acc\_land\_balance\_bonus               | NUMERIC | Land-based (retail) wallet: bonus balance                                                                   |
| acc\_land\_balance\_total               | NUMERIC | Land-based (retail) wallet: total balance                                                                   |

### dwh\_ext\_xxx.tr\_acc\_withdrawal\_approved

Approved withdrawals. One row per withdrawal.

**Joins:**

* acc\_wd\_payment\_method → [lookup\_acc\_wd\_payment\_method](#text-of-value-ids) (id)
* acc\_wd\_payment\_sub\_method → [lookup\_acc\_wd\_payment\_sub\_method](#text-of-value-ids) (id)
* acc\_wd\_payment\_provider → [lookup\_acc\_wd\_payment\_provider](#text-of-value-ids) (id)
* acc\_wd\_platform → [lookup\_acc\_wd\_platform](#text-of-value-ids) (id)
* acc\_wd\_source → [lookup\_acc\_wd\_source](#text-of-value-ids) (id)

| Column                                  | Type    | Description                                                                                                                                   |
| --------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| acc\_last\_transaction\_id              | STRING  | ID of the transaction in your platform                                                                                                        |
| acc\_last\_withdrawal\_amount           | NUMERIC | Withdrawal amount                                                                                                                             |
| acc\_last\_original\_withdrawal\_amount | NUMERIC | Withdrawal amount in its original currency, not converted to the wallet currency                                                              |
| acc\_wd\_payment\_method                | INT64   | Payment method of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_method                                                     |
| acc\_wd\_payment\_sub\_method           | INT64   | Payment sub-method of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_sub\_method                                            |
| acc\_wd\_payment\_provider              | INT64   | Payment provider of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_provider                                                 |
| acc\_wd\_platform                       | INT64   | Platform from which the withdrawal was made. ID of a value; text in lookup\_acc\_wd\_platform                                                 |
| acc\_wd\_source                         | INT64   | Source of the withdrawal (for example on site or cash desk). ID of a value; text in lookup\_acc\_wd\_source                                   |
| acc\_is\_rollback                       | BOOL    | TRUE when the transaction cancels an earlier one. A rollback should carry negative amounts, so that a sum of the amounts gives the net amount |
| core\_is\_exclude\_from\_report         | BOOL    | TRUE when your platform marked the transaction to be left out of reports                                                                      |
| acc\_utm\_value                         | STRING  | UTM marker that shows the marketing source of the transaction                                                                                 |
| acc\_real\_balance                      | NUMERIC | Real money balance after the transaction, as your platform reports it                                                                         |
| acc\_bonus\_balance                     | NUMERIC | Bonus money balance after the transaction, as your platform reports it                                                                        |
| acc\_land\_balance\_real                | NUMERIC | Land-based (retail) wallet: real money balance                                                                                                |
| acc\_land\_balance\_bonus               | NUMERIC | Land-based (retail) wallet: bonus balance                                                                                                     |
| acc\_land\_balance\_total               | NUMERIC | Land-based (retail) wallet: total balance                                                                                                     |
| acc\_sc\_last\_withdrawal\_amount       | NUMERIC | Sweepstakes: SC coins amount of the withdrawal                                                                                                |
| fin\_last\_trading\_account\_id         | NUMERIC | Trading platforms: ID of the trading account                                                                                                  |

### dwh\_ext\_xxx.tr\_acc\_withdrawal\_completed

Completed (paid out) withdrawals. One row per withdrawal.

**Joins:**

* acc\_wd\_payment\_method → [lookup\_acc\_wd\_payment\_method](#text-of-value-ids) (id)
* acc\_wd\_payment\_sub\_method → [lookup\_acc\_wd\_payment\_sub\_method](#text-of-value-ids) (id)
* acc\_wd\_payment\_provider → [lookup\_acc\_wd\_payment\_provider](#text-of-value-ids) (id)
* acc\_wd\_platform → [lookup\_acc\_wd\_platform](#text-of-value-ids) (id)
* acc\_wd\_source → [lookup\_acc\_wd\_source](#text-of-value-ids) (id)

| Column                                  | Type    | Description                                                                                                                                   |
| --------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| acc\_last\_transaction\_id              | STRING  | ID of the transaction in your platform                                                                                                        |
| acc\_last\_withdrawal\_amount           | NUMERIC | Withdrawal amount                                                                                                                             |
| acc\_last\_original\_withdrawal\_amount | NUMERIC | Withdrawal amount in its original currency, not converted to the wallet currency                                                              |
| acc\_wd\_payment\_method                | INT64   | Payment method of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_method                                                     |
| acc\_wd\_payment\_sub\_method           | INT64   | Payment sub-method of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_sub\_method                                            |
| acc\_wd\_payment\_provider              | INT64   | Payment provider of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_provider                                                 |
| acc\_wd\_platform                       | INT64   | Platform from which the withdrawal was made. ID of a value; text in lookup\_acc\_wd\_platform                                                 |
| acc\_wd\_source                         | INT64   | Source of the withdrawal (for example on site or cash desk). ID of a value; text in lookup\_acc\_wd\_source                                   |
| acc\_is\_rollback                       | BOOL    | TRUE when the transaction cancels an earlier one. A rollback should carry negative amounts, so that a sum of the amounts gives the net amount |
| core\_is\_exclude\_from\_report         | BOOL    | TRUE when your platform marked the transaction to be left out of reports                                                                      |
| acc\_utm\_value                         | STRING  | UTM marker that shows the marketing source of the transaction                                                                                 |
| acc\_real\_balance                      | NUMERIC | Real money balance after the transaction, as your platform reports it                                                                         |
| acc\_bonus\_balance                     | NUMERIC | Bonus money balance after the transaction, as your platform reports it                                                                        |
| acc\_land\_balance\_real                | NUMERIC | Land-based (retail) wallet: real money balance                                                                                                |
| acc\_land\_balance\_bonus               | NUMERIC | Land-based (retail) wallet: bonus balance                                                                                                     |
| acc\_land\_balance\_total               | NUMERIC | Land-based (retail) wallet: total balance                                                                                                     |

### dwh\_ext\_xxx.tr\_acc\_withdrawal\_cancelled

Canceled withdrawals. One row per canceled withdrawal.

**Joins:**

* acc\_wd\_payment\_method → [lookup\_acc\_wd\_payment\_method](#text-of-value-ids) (id)
* acc\_wd\_payment\_sub\_method → [lookup\_acc\_wd\_payment\_sub\_method](#text-of-value-ids) (id)
* acc\_wd\_payment\_provider → [lookup\_acc\_wd\_payment\_provider](#text-of-value-ids) (id)
* acc\_wd\_platform → [lookup\_acc\_wd\_platform](#text-of-value-ids) (id)
* acc\_wd\_source → [lookup\_acc\_wd\_source](#text-of-value-ids) (id)

| Column                                  | Type    | Description                                                                                                 |
| --------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------- |
| acc\_last\_transaction\_id              | STRING  | ID of the transaction in your platform                                                                      |
| acc\_last\_withdrawal\_amount           | NUMERIC | Withdrawal amount                                                                                           |
| acc\_last\_original\_withdrawal\_amount | NUMERIC | Withdrawal amount in its original currency, not converted to the wallet currency                            |
| acc\_wd\_payment\_method                | INT64   | Payment method of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_method                   |
| acc\_wd\_payment\_sub\_method           | INT64   | Payment sub-method of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_sub\_method          |
| acc\_wd\_payment\_provider              | INT64   | Payment provider of the withdrawal. ID of a value; text in lookup\_acc\_wd\_payment\_provider               |
| acc\_wd\_platform                       | INT64   | Platform from which the withdrawal was made. ID of a value; text in lookup\_acc\_wd\_platform               |
| acc\_wd\_source                         | INT64   | Source of the withdrawal (for example on site or cash desk). ID of a value; text in lookup\_acc\_wd\_source |
| acc\_utm\_value                         | STRING  | UTM marker that shows the marketing source of the transaction                                               |
| acc\_real\_balance                      | NUMERIC | Real money balance after the transaction, as your platform reports it                                       |
| acc\_bonus\_balance                     | NUMERIC | Bonus money balance after the transaction, as your platform reports it                                      |
| acc\_land\_balance\_real                | NUMERIC | Land-based (retail) wallet: real money balance                                                              |
| acc\_land\_balance\_bonus               | NUMERIC | Land-based (retail) wallet: bonus balance                                                                   |
| acc\_land\_balance\_total               | NUMERIC | Land-based (retail) wallet: total balance                                                                   |

## Casino Activity (from PAM)

Your platform reports casino play either as separate bets and wins (**tr\_casino\_bet**, **tr\_casino\_win**) or as one event per game round (**tr\_casino\_bet\_win**). Use the views your platform fills.

### dwh\_ext\_xxx.tr\_casino\_bet

Casino bets. One row per bet.

**Joins:**

* casino\_last\_bet\_game\_name → [dm\_casino\_game\_name](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_casino_game_name) (smr\_game\_id)
* casino\_last\_bet\_game\_provider → [dm\_casino\_provider\_name](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_casino_provider_name) (smr\_provider\_id)
* casino\_last\_bet\_game\_type → [dm\_casino\_game\_type](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_casino_game_type) (smr\_game\_type\_id)
* casino\_last\_bet\_game\_type\_arr → [lookup\_casino\_last\_bet\_game\_type\_arr](#text-of-value-ids) (id)
* casino\_last\_bet\_game\_sub\_type → [lookup\_casino\_last\_bet\_game\_sub\_type](#text-of-value-ids) (id)
* casino\_last\_bet\_game\_category → [lookup\_casino\_last\_bet\_game\_category](#text-of-value-ids) (id)
* casino\_last\_bet\_game\_vendor → [lookup\_casino\_last\_bet\_game\_vendor](#text-of-value-ids) (id)
* casino\_last\_bet\_platform → [lookup\_casino\_last\_bet\_platform](#text-of-value-ids) (id)
* casino\_last\_bet\_status → [lookup\_casino\_last\_bet\_status](#text-of-value-ids) (id)
* acc\_last\_active\_currency → [lookup\_acc\_last\_active\_currency](#text-of-value-ids) (id)

| Column                                     | Type     | Description                                                                                                                                  |
| ------------------------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| casino\_last\_bet\_id                      | STRING   | ID of the bet in your platform                                                                                                               |
| casino\_last\_bet\_amount                  | NUMERIC  | Bet amount, real and bonus money                                                                                                             |
| casino\_last\_bet\_amount\_real            | NUMERIC  | Bet amount, real money part                                                                                                                  |
| casino\_last\_bet\_amount\_bonus           | NUMERIC  | Bet amount, bonus money part                                                                                                                 |
| casino\_last\_original\_bet\_amount        | NUMERIC  | Bet amount in its original currency, not converted to the wallet currency                                                                    |
| casino\_last\_original\_bet\_amount\_real  | NUMERIC  | Original-currency bet amount, real money part                                                                                                |
| casino\_last\_original\_bet\_amount\_bonus | NUMERIC  | Original-currency bet amount, bonus money part                                                                                               |
| casino\_last\_bet\_game\_name              | INT64    | Name of the game. ID of a value; joins to dm\_casino\_game\_name                                                                             |
| casino\_last\_bet\_game\_provider          | INT64    | Game provider. ID of a value; joins to dm\_casino\_provider\_name                                                                            |
| casino\_last\_bet\_game\_type              | INT64    | Game type (for example slots). ID of a value; joins to dm\_casino\_game\_type                                                                |
| casino\_last\_bet\_game\_type\_arr         | INT64\[] | All game types of the game, when your platform gives a game several types. IDs of values; text in lookup\_casino\_last\_bet\_game\_type\_arr |
| casino\_last\_bet\_game\_sub\_type         | INT64    | Sub-type of the game. ID of a value; text in lookup\_casino\_last\_bet\_game\_sub\_type                                                      |
| casino\_last\_bet\_game\_category          | INT64    | Another grouping of the game (for example e-games). ID of a value; text in lookup\_casino\_last\_bet\_game\_category                         |
| casino\_last\_bet\_game\_vendor            | INT64    | Game vendor. ID of a value; text in lookup\_casino\_last\_bet\_game\_vendor                                                                  |
| casino\_game\_ext\_id                      | STRING   | ID of the game in your game catalog                                                                                                          |
| casino\_game\_provider\_ext\_id            | STRING   | ID of the game provider in your game catalog                                                                                                 |
| casino\_game\_type\_ext\_id                | STRING   | ID of the game type in your game catalog                                                                                                     |
| casino\_last\_bet\_platform                | INT64    | Platform of the bet (for example web or mobile). ID of a value; text in lookup\_casino\_last\_bet\_platform                                  |
| casino\_last\_bet\_status                  | INT64    | Status of the bet, if your platform sends one. ID of a value; text in lookup\_casino\_last\_bet\_status                                      |
| casino\_is\_free\_bet                      | BOOL     | TRUE for a free bet                                                                                                                          |
| casino\_is\_rollback                       | BOOL     | TRUE when the transaction cancels an earlier one. A rollback should carry negative amounts                                                   |
| core\_is\_exclude\_from\_report            | BOOL     | TRUE when your platform marked the transaction to be left out of reports                                                                     |
| acc\_last\_active\_currency                | INT64    | For players with several wallets: the currency of the active wallet. ID of a value; text in lookup\_acc\_last\_active\_currency              |
| acc\_real\_balance                         | NUMERIC  | Real money balance after the transaction, as your platform reports it                                                                        |
| acc\_bonus\_balance                        | NUMERIC  | Bonus money balance after the transaction, as your platform reports it                                                                       |
| acc\_land\_balance\_real                   | NUMERIC  | Land-based (retail) wallet: real money balance                                                                                               |
| acc\_land\_balance\_bonus                  | NUMERIC  | Land-based (retail) wallet: bonus balance                                                                                                    |
| acc\_land\_balance\_total                  | NUMERIC  | Land-based (retail) wallet: total balance                                                                                                    |
| casino\_gc\_bet\_amount                    | NUMERIC  | Sweepstakes: bet amount in gold coins (GC)                                                                                                   |
| casino\_sc\_bet\_amount                    | NUMERIC  | Sweepstakes: bet amount in SC coins                                                                                                          |

### dwh\_ext\_xxx.tr\_casino\_win

Casino wins (results of bets). One row per result.

**Joins:**

* casino\_last\_bet\_game\_name → [dm\_casino\_game\_name](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_casino_game_name) (smr\_game\_id)
* casino\_last\_bet\_game\_provider → [dm\_casino\_provider\_name](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_casino_provider_name) (smr\_provider\_id)
* casino\_last\_bet\_game\_type → [dm\_casino\_game\_type](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_casino_game_type) (smr\_game\_type\_id)
* casino\_last\_bet\_game\_type\_arr → [lookup\_casino\_last\_bet\_game\_type\_arr](#text-of-value-ids) (id)
* casino\_last\_bet\_game\_sub\_type → [lookup\_casino\_last\_bet\_game\_sub\_type](#text-of-value-ids) (id)
* casino\_last\_bet\_game\_category → [lookup\_casino\_last\_bet\_game\_category](#text-of-value-ids) (id)
* casino\_last\_bet\_game\_vendor → [lookup\_casino\_last\_bet\_game\_vendor](#text-of-value-ids) (id)
* casino\_last\_bet\_platform → [lookup\_casino\_last\_bet\_platform](#text-of-value-ids) (id)
* casino\_last\_bet\_status → [lookup\_casino\_last\_bet\_status](#text-of-value-ids) (id)
* acc\_last\_active\_currency → [lookup\_acc\_last\_active\_currency](#text-of-value-ids) (id)

| Column                                     | Type     | Description                                                                                                                                  |
| ------------------------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| casino\_last\_bet\_id                      | STRING   | ID of the bet in your platform                                                                                                               |
| casino\_last\_bet\_amount                  | NUMERIC  | Bet amount, real and bonus money                                                                                                             |
| casino\_last\_bet\_amount\_real            | NUMERIC  | Bet amount, real money part                                                                                                                  |
| casino\_last\_bet\_amount\_bonus           | NUMERIC  | Bet amount, bonus money part                                                                                                                 |
| casino\_last\_win\_amount                  | NUMERIC  | Win amount, real and bonus money. 0 for a lost bet                                                                                           |
| casino\_last\_win\_amount\_real            | NUMERIC  | Win amount, real money part                                                                                                                  |
| casino\_last\_win\_amount\_bonus           | NUMERIC  | Win amount, bonus money part                                                                                                                 |
| casino\_last\_bet\_profit                  | NUMERIC  | Player's result in real money: real win minus real bet                                                                                       |
| casino\_last\_bet\_profit\_total           | NUMERIC  | Player's result: total win minus total bet (real and bonus money)                                                                            |
| casino\_last\_win\_multiplier              | NUMERIC  | Win amount divided by bet amount (real and bonus money). 0 for a lost bet                                                                    |
| casino\_last\_win\_multiplier\_real        | NUMERIC  | Win amount divided by bet amount, real money only                                                                                            |
| casino\_last\_original\_bet\_amount        | NUMERIC  | Bet amount in its original currency, not converted to the wallet currency                                                                    |
| casino\_last\_original\_bet\_amount\_real  | NUMERIC  | Original-currency bet amount, real money part                                                                                                |
| casino\_last\_original\_bet\_amount\_bonus | NUMERIC  | Original-currency bet amount, bonus money part                                                                                               |
| casino\_last\_original\_win\_amount        | NUMERIC  | Win amount in its original currency, not converted to the wallet currency                                                                    |
| casino\_last\_original\_win\_amount\_real  | NUMERIC  | Original-currency win amount, real money part                                                                                                |
| casino\_last\_original\_win\_amount\_bonus | NUMERIC  | Original-currency win amount, bonus money part                                                                                               |
| casino\_last\_bet\_game\_name              | INT64    | Name of the game. ID of a value; joins to dm\_casino\_game\_name                                                                             |
| casino\_last\_bet\_game\_provider          | INT64    | Game provider. ID of a value; joins to dm\_casino\_provider\_name                                                                            |
| casino\_last\_bet\_game\_type              | INT64    | Game type (for example slots). ID of a value; joins to dm\_casino\_game\_type                                                                |
| casino\_last\_bet\_game\_type\_arr         | INT64\[] | All game types of the game, when your platform gives a game several types. IDs of values; text in lookup\_casino\_last\_bet\_game\_type\_arr |
| casino\_last\_bet\_game\_sub\_type         | INT64    | Sub-type of the game. ID of a value; text in lookup\_casino\_last\_bet\_game\_sub\_type                                                      |
| casino\_last\_bet\_game\_category          | INT64    | Another grouping of the game (for example e-games). ID of a value; text in lookup\_casino\_last\_bet\_game\_category                         |
| casino\_last\_bet\_game\_vendor            | INT64    | Game vendor. ID of a value; text in lookup\_casino\_last\_bet\_game\_vendor                                                                  |
| casino\_game\_ext\_id                      | STRING   | ID of the game in your game catalog                                                                                                          |
| casino\_game\_provider\_ext\_id            | STRING   | ID of the game provider in your game catalog                                                                                                 |
| casino\_game\_type\_ext\_id                | STRING   | ID of the game type in your game catalog                                                                                                     |
| casino\_last\_bet\_platform                | INT64    | Platform of the bet (for example web or mobile). ID of a value; text in lookup\_casino\_last\_bet\_platform                                  |
| casino\_last\_bet\_status                  | INT64    | Status of the bet, if your platform sends one. ID of a value; text in lookup\_casino\_last\_bet\_status                                      |
| casino\_is\_free\_bet                      | BOOL     | TRUE for a free bet                                                                                                                          |
| casino\_is\_rollback                       | BOOL     | TRUE when the transaction cancels an earlier one. A rollback should carry negative amounts                                                   |
| core\_is\_exclude\_from\_report            | BOOL     | TRUE when your platform marked the transaction to be left out of reports                                                                     |
| acc\_last\_active\_currency                | INT64    | For players with several wallets: the currency of the active wallet. ID of a value; text in lookup\_acc\_last\_active\_currency              |
| acc\_real\_balance                         | NUMERIC  | Real money balance after the transaction, as your platform reports it                                                                        |
| acc\_bonus\_balance                        | NUMERIC  | Bonus money balance after the transaction, as your platform reports it                                                                       |
| acc\_land\_balance\_real                   | NUMERIC  | Land-based (retail) wallet: real money balance                                                                                               |
| acc\_land\_balance\_bonus                  | NUMERIC  | Land-based (retail) wallet: bonus balance                                                                                                    |
| acc\_land\_balance\_total                  | NUMERIC  | Land-based (retail) wallet: total balance                                                                                                    |
| casino\_gc\_bet\_amount                    | NUMERIC  | Sweepstakes: bet amount in gold coins (GC)                                                                                                   |
| casino\_gc\_win\_amount                    | NUMERIC  | Sweepstakes: win amount in gold coins (GC)                                                                                                   |
| casino\_sc\_bet\_amount                    | NUMERIC  | Sweepstakes: bet amount in SC coins                                                                                                          |
| casino\_sc\_win\_amount                    | NUMERIC  | Sweepstakes: win amount in SC coins                                                                                                          |

### dwh\_ext\_xxx.tr\_casino\_bet\_win

Casino game rounds, with the bet and the win in one row. One row per round.

**Joins:**

* casino\_last\_bet\_game\_name → [dm\_casino\_game\_name](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_casino_game_name) (smr\_game\_id)
* casino\_last\_bet\_game\_provider → [dm\_casino\_provider\_name](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_casino_provider_name) (smr\_provider\_id)
* casino\_last\_bet\_game\_type → [dm\_casino\_game\_type](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_casino_game_type) (smr\_game\_type\_id)
* casino\_last\_bet\_game\_type\_arr → [lookup\_casino\_last\_bet\_game\_type\_arr](#text-of-value-ids) (id)
* casino\_last\_bet\_game\_sub\_type → [lookup\_casino\_last\_bet\_game\_sub\_type](#text-of-value-ids) (id)
* casino\_last\_bet\_game\_category → [lookup\_casino\_last\_bet\_game\_category](#text-of-value-ids) (id)
* casino\_last\_bet\_game\_vendor → [lookup\_casino\_last\_bet\_game\_vendor](#text-of-value-ids) (id)
* casino\_last\_bet\_platform → [lookup\_casino\_last\_bet\_platform](#text-of-value-ids) (id)
* casino\_last\_bet\_status → [lookup\_casino\_last\_bet\_status](#text-of-value-ids) (id)
* acc\_last\_active\_currency → [lookup\_acc\_last\_active\_currency](#text-of-value-ids) (id)

| Column                                     | Type     | Description                                                                                                                                  |
| ------------------------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| casino\_last\_bet\_id                      | STRING   | ID of the bet in your platform                                                                                                               |
| casino\_last\_bet\_amount                  | NUMERIC  | Bet amount, real and bonus money                                                                                                             |
| casino\_last\_bet\_amount\_real            | NUMERIC  | Bet amount, real money part                                                                                                                  |
| casino\_last\_bet\_amount\_bonus           | NUMERIC  | Bet amount, bonus money part                                                                                                                 |
| casino\_last\_win\_amount                  | NUMERIC  | Win amount, real and bonus money. 0 for a lost bet                                                                                           |
| casino\_last\_win\_amount\_real            | NUMERIC  | Win amount, real money part                                                                                                                  |
| casino\_last\_win\_amount\_bonus           | NUMERIC  | Win amount, bonus money part                                                                                                                 |
| casino\_last\_bet\_profit                  | NUMERIC  | Player's result in real money: real win minus real bet                                                                                       |
| casino\_last\_bet\_profit\_total           | NUMERIC  | Player's result: total win minus total bet (real and bonus money)                                                                            |
| casino\_last\_win\_multiplier              | NUMERIC  | Win amount divided by bet amount (real and bonus money). 0 for a lost bet                                                                    |
| casino\_last\_win\_multiplier\_real        | NUMERIC  | Win amount divided by bet amount, real money only                                                                                            |
| casino\_last\_original\_bet\_amount        | NUMERIC  | Bet amount in its original currency, not converted to the wallet currency                                                                    |
| casino\_last\_original\_bet\_amount\_real  | NUMERIC  | Original-currency bet amount, real money part                                                                                                |
| casino\_last\_original\_bet\_amount\_bonus | NUMERIC  | Original-currency bet amount, bonus money part                                                                                               |
| casino\_last\_original\_win\_amount        | NUMERIC  | Win amount in its original currency, not converted to the wallet currency                                                                    |
| casino\_last\_original\_win\_amount\_real  | NUMERIC  | Original-currency win amount, real money part                                                                                                |
| casino\_last\_original\_win\_amount\_bonus | NUMERIC  | Original-currency win amount, bonus money part                                                                                               |
| casino\_last\_bet\_game\_name              | INT64    | Name of the game. ID of a value; joins to dm\_casino\_game\_name                                                                             |
| casino\_last\_bet\_game\_provider          | INT64    | Game provider. ID of a value; joins to dm\_casino\_provider\_name                                                                            |
| casino\_last\_bet\_game\_type              | INT64    | Game type (for example slots). ID of a value; joins to dm\_casino\_game\_type                                                                |
| casino\_last\_bet\_game\_type\_arr         | INT64\[] | All game types of the game, when your platform gives a game several types. IDs of values; text in lookup\_casino\_last\_bet\_game\_type\_arr |
| casino\_last\_bet\_game\_sub\_type         | INT64    | Sub-type of the game. ID of a value; text in lookup\_casino\_last\_bet\_game\_sub\_type                                                      |
| casino\_last\_bet\_game\_category          | INT64    | Another grouping of the game (for example e-games). ID of a value; text in lookup\_casino\_last\_bet\_game\_category                         |
| casino\_last\_bet\_game\_vendor            | INT64    | Game vendor. ID of a value; text in lookup\_casino\_last\_bet\_game\_vendor                                                                  |
| casino\_game\_ext\_id                      | STRING   | ID of the game in your game catalog                                                                                                          |
| casino\_game\_provider\_ext\_id            | STRING   | ID of the game provider in your game catalog                                                                                                 |
| casino\_game\_type\_ext\_id                | STRING   | ID of the game type in your game catalog                                                                                                     |
| casino\_last\_bet\_platform                | INT64    | Platform of the bet (for example web or mobile). ID of a value; text in lookup\_casino\_last\_bet\_platform                                  |
| casino\_last\_bet\_status                  | INT64    | Status of the bet, if your platform sends one. ID of a value; text in lookup\_casino\_last\_bet\_status                                      |
| casino\_last\_session\_bet\_count          | NUMERIC  | Number of bets in the player's last casino session                                                                                           |
| casino\_last\_session\_avg\_bet\_amount    | NUMERIC  | Average bet amount in the player's last casino session                                                                                       |
| casino\_is\_free\_bet                      | BOOL     | TRUE for a free bet                                                                                                                          |
| casino\_is\_rollback                       | BOOL     | TRUE when the transaction cancels an earlier one. A rollback should carry negative amounts                                                   |
| core\_is\_exclude\_from\_report            | BOOL     | TRUE when your platform marked the transaction to be left out of reports                                                                     |
| acc\_last\_active\_currency                | INT64    | For players with several wallets: the currency of the active wallet. ID of a value; text in lookup\_acc\_last\_active\_currency              |
| acc\_real\_balance                         | NUMERIC  | Real money balance after the transaction, as your platform reports it                                                                        |
| acc\_bonus\_balance                        | NUMERIC  | Bonus money balance after the transaction, as your platform reports it                                                                       |
| acc\_land\_balance\_real                   | NUMERIC  | Land-based (retail) wallet: real money balance                                                                                               |
| acc\_land\_balance\_bonus                  | NUMERIC  | Land-based (retail) wallet: bonus balance                                                                                                    |
| acc\_land\_balance\_total                  | NUMERIC  | Land-based (retail) wallet: total balance                                                                                                    |
| casino\_gc\_bet\_amount                    | NUMERIC  | Sweepstakes: bet amount in gold coins (GC)                                                                                                   |
| casino\_gc\_win\_amount                    | NUMERIC  | Sweepstakes: win amount in gold coins (GC)                                                                                                   |
| casino\_sc\_bet\_amount                    | NUMERIC  | Sweepstakes: bet amount in SC coins                                                                                                          |
| casino\_sc\_win\_amount                    | NUMERIC  | Sweepstakes: win amount in SC coins                                                                                                          |

Top 10 games of the previous day by bet amount in the label currency, from tr\_casino\_bet\_win

```sql
SELECT G.game_name,
       COUNT(*) AS rounds,
       SUM(SAFE_DIVIDE(B.casino_last_bet_amount, B.user_to_label_cur_rate)) AS bet_amount_label_currency,
       SUM(SAFE_DIVIDE(B.casino_last_win_amount, B.user_to_label_cur_rate)) AS win_amount_label_currency
FROM dwh_ext_xxx.tr_casino_bet_win B
LEFT JOIN dwh_ext_xxx.dm_casino_game_name G ON G.smr_game_id = B.casino_last_bet_game_name
WHERE B.event_time >= TIMESTAMP_TRUNC(TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY), DAY)
  AND B.event_time < TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), DAY)
GROUP BY G.game_name
ORDER BY bet_amount_label_currency DESC
LIMIT 10
```

## Sports Betting (from PAM)

A sport bet comes as four events: the bet is opened, each selection is opened, each selection is settled, and the bet is settled. **sport\_last\_bet\_id** is the same in all four views, so use it to join them.

### dwh\_ext\_xxx.tr\_sport\_bet\_open

Sport bets placed. One row per bet.

**Joins:**

* sport\_last\_bet\_type → [lookup\_sport\_last\_bet\_type](#text-of-value-ids) (id)
* sport\_last\_bet\_timing → [lookup\_sport\_last\_bet\_timing](#text-of-value-ids) (id)
* sport\_last\_bet\_sports → [lookup\_sport\_last\_bet\_sports](#text-of-value-ids) (id)
* sport\_last\_bet\_leagues → [lookup\_sport\_last\_bet\_leagues](#text-of-value-ids) (id)
* sport\_last\_bet\_markets → [lookup\_sport\_last\_bet\_markets](#text-of-value-ids) (id)
* sport\_last\_bet\_competitors → [lookup\_sport\_last\_bet\_competitors](#text-of-value-ids) (id)
* sport\_last\_bet\_match\_ids → [lookup\_sport\_last\_bet\_match\_ids](#text-of-value-ids) (id)
* sport\_last\_bet\_platform → [lookup\_sport\_last\_bet\_platform](#text-of-value-ids) (id)
* sport\_last\_bet\_provider → [lookup\_sport\_last\_bet\_provider](#text-of-value-ids) (id)
* acc\_last\_active\_currency → [lookup\_acc\_last\_active\_currency](#text-of-value-ids) (id)

| Column                                    | Type     | Description                                                                                                                                     |
| ----------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| sport\_last\_bet\_id                      | STRING   | ID of the bet in your platform. The same in the bet open, selection open, selection settled and bet settled views                               |
| sport\_match\_id                          | STRING   | ID of the match                                                                                                                                 |
| sport\_last\_bet\_amount                  | NUMERIC  | Bet amount for the whole bet (all selections), real and bonus money                                                                             |
| sport\_last\_bet\_amount\_real            | NUMERIC  | Bet amount, real money part                                                                                                                     |
| sport\_last\_bet\_amount\_bonus           | NUMERIC  | Bet amount, bonus money part                                                                                                                    |
| sport\_last\_bonus\_bet\_amount           | NUMERIC  | Bonus bet amount for the whole bet, as your platform reports it                                                                                 |
| sport\_last\_original\_bet\_amount        | NUMERIC  | Bet amount in its original currency, not converted to the wallet currency                                                                       |
| sport\_last\_original\_bet\_amount\_real  | NUMERIC  | Original-currency bet amount, real money part                                                                                                   |
| sport\_last\_original\_bet\_amount\_bonus | NUMERIC  | Original-currency bet amount, bonus money part                                                                                                  |
| sport\_last\_bet\_odds                    | NUMERIC  | Odds of the bet                                                                                                                                 |
| sport\_last\_max\_selection\_odds         | NUMERIC  | Highest odds among the selections of the bet                                                                                                    |
| sport\_last\_min\_selection\_odds         | NUMERIC  | Lowest odds among the selections of the bet                                                                                                     |
| sport\_last\_bet\_selection\_count        | NUMERIC  | Number of selections in the bet                                                                                                                 |
| sport\_last\_bet\_type                    | INT64    | Type of the bet (for example single, combo or system). ID of a value; text in lookup\_sport\_last\_bet\_type                                    |
| sport\_last\_bet\_timing                  | INT64    | Live or pre-match. ID of a value; text in lookup\_sport\_last\_bet\_timing                                                                      |
| sport\_last\_bet\_sports                  | INT64\[] | Sports of the selections. IDs of values; text in lookup\_sport\_last\_bet\_sports                                                               |
| sport\_last\_bet\_leagues                 | INT64\[] | Leagues of the selections. IDs of values; text in lookup\_sport\_last\_bet\_leagues                                                             |
| sport\_last\_bet\_markets                 | INT64\[] | Markets of the selections. IDs of values; text in lookup\_sport\_last\_bet\_markets                                                             |
| sport\_last\_bet\_competitors             | INT64\[] | Competitors of the selections. IDs of values; text in lookup\_sport\_last\_bet\_competitors                                                     |
| sport\_last\_bet\_match\_ids              | INT64\[] | Matches of the selections. IDs of values (text in lookup\_sport\_last\_bet\_match\_ids), not the match IDs; the match ID is in sport\_match\_id |
| sport\_last\_bet\_platform                | INT64    | Platform of the bet (for example web or mobile). ID of a value; text in lookup\_sport\_last\_bet\_platform                                      |
| sport\_last\_bet\_provider                | INT64    | Sportsbook provider. ID of a value; text in lookup\_sport\_last\_bet\_provider                                                                  |
| sport\_last\_bet\_virtual                 | BOOL     | TRUE for a bet on a virtual sport                                                                                                               |
| sport\_is\_bet\_builder                   | BOOL     | TRUE for a bet builder bet                                                                                                                      |
| sport\_is\_free\_bet                      | BOOL     | TRUE for a free bet                                                                                                                             |
| core\_is\_exclude\_from\_report           | BOOL     | TRUE when your platform marked the transaction to be left out of reports                                                                        |
| acc\_last\_active\_currency               | INT64    | For players with several wallets: the currency of the active wallet. ID of a value; text in lookup\_acc\_last\_active\_currency                 |
| acc\_real\_balance                        | NUMERIC  | Real money balance after the transaction, as your platform reports it                                                                           |
| acc\_bonus\_balance                       | NUMERIC  | Bonus money balance after the transaction, as your platform reports it                                                                          |
| acc\_land\_balance\_real                  | NUMERIC  | Land-based (retail) wallet: real money balance                                                                                                  |
| acc\_land\_balance\_bonus                 | NUMERIC  | Land-based (retail) wallet: bonus balance                                                                                                       |
| acc\_land\_balance\_total                 | NUMERIC  | Land-based (retail) wallet: total balance                                                                                                       |
| sport\_gc\_bet\_amount                    | NUMERIC  | Sweepstakes: bet amount in gold coins (GC)                                                                                                      |
| sport\_sc\_bet\_amount                    | NUMERIC  | Sweepstakes: bet amount in SC coins                                                                                                             |

### dwh\_ext\_xxx.tr\_sport\_bet\_selection\_open

Selections of placed sport bets. One row per selection.

**Joins:**

* sport\_last\_selection\_sport\_type → [dm\_sport\_type](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_sport_type) (smr\_sport\_type\_id)
* sport\_last\_selection\_league → [dm\_sport\_league](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_sport_league) (smr\_sport\_league\_id)
* sport\_last\_bet\_type → [lookup\_sport\_last\_bet\_type](#text-of-value-ids) (id)
* sport\_last\_selection\_market → [lookup\_sport\_last\_selection\_market](#text-of-value-ids) (id)
* sport\_last\_selection\_home\_team → [lookup\_sport\_last\_selection\_home\_team](#text-of-value-ids) (id)
* sport\_last\_selection\_away\_team → [lookup\_sport\_last\_selection\_away\_team](#text-of-value-ids) (id)
* sport\_last\_selection\_competitors → [lookup\_sport\_last\_selection\_competitors](#text-of-value-ids) (id)
* sport\_last\_bet\_platform → [lookup\_sport\_last\_bet\_platform](#text-of-value-ids) (id)
* sport\_last\_bet\_provider → [lookup\_sport\_last\_bet\_provider](#text-of-value-ids) (id)

| Column                                    | Type     | Description                                                                                                       |
| ----------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
| sport\_last\_bet\_id                      | STRING   | ID of the bet in your platform. The same in the bet open, selection open, selection settled and bet settled views |
| sport\_last\_selection\_id                | STRING   | ID of the selection in your platform                                                                              |
| sport\_match\_id                          | STRING   | ID of the match                                                                                                   |
| sport\_last\_bet\_amount                  | NUMERIC  | Bet amount for the whole bet (all selections), real and bonus money                                               |
| sport\_last\_bet\_amount\_real            | NUMERIC  | Bet amount, real money part                                                                                       |
| sport\_last\_bet\_amount\_bonus           | NUMERIC  | Bet amount, bonus money part                                                                                      |
| sport\_last\_bonus\_bet\_amount           | NUMERIC  | Bonus bet amount for the whole bet, as your platform reports it                                                   |
| sport\_last\_selection\_bet\_amount       | NUMERIC  | Bet amount of this selection                                                                                      |
| sport\_last\_original\_bet\_amount        | NUMERIC  | Bet amount in its original currency, not converted to the wallet currency                                         |
| sport\_last\_original\_bet\_amount\_real  | NUMERIC  | Original-currency bet amount, real money part                                                                     |
| sport\_last\_original\_bet\_amount\_bonus | NUMERIC  | Original-currency bet amount, bonus money part                                                                    |
| sport\_last\_selection\_odds              | NUMERIC  | Odds of this selection                                                                                            |
| sport\_last\_max\_selection\_odds         | NUMERIC  | Highest odds among the selections of the bet                                                                      |
| sport\_last\_min\_selection\_odds         | NUMERIC  | Lowest odds among the selections of the bet                                                                       |
| sport\_last\_bet\_selection\_count        | NUMERIC  | Number of selections in the bet                                                                                   |
| sport\_last\_bet\_type                    | INT64    | Type of the bet (for example single, combo or system). ID of a value; text in lookup\_sport\_last\_bet\_type      |
| sport\_last\_selection\_sport\_type       | INT64    | Sport of the selection. ID of a value; joins to dm\_sport\_type                                                   |
| sport\_last\_selection\_league            | INT64    | League of the selection. ID of a value; joins to dm\_sport\_league                                                |
| sport\_last\_selection\_market            | INT64    | Market of the selection. ID of a value; text in lookup\_sport\_last\_selection\_market                            |
| sport\_last\_selection\_home\_team        | INT64    | Home team. ID of a value; text in lookup\_sport\_last\_selection\_home\_team                                      |
| sport\_last\_selection\_away\_team        | INT64    | Away team. ID of a value; text in lookup\_sport\_last\_selection\_away\_team                                      |
| sport\_last\_selection\_competitors       | INT64\[] | Competitors of the selection. IDs of values; text in lookup\_sport\_last\_selection\_competitors                  |
| sport\_last\_bet\_platform                | INT64    | Platform of the bet (for example web or mobile). ID of a value; text in lookup\_sport\_last\_bet\_platform        |
| sport\_last\_bet\_provider                | INT64    | Sportsbook provider. ID of a value; text in lookup\_sport\_last\_bet\_provider                                    |
| sport\_last\_selection\_is\_live          | BOOL     | TRUE for a live selection                                                                                         |
| sport\_last\_selection\_virtual           | BOOL     | TRUE for a selection on a virtual sport                                                                           |
| sport\_is\_bet\_builder                   | BOOL     | TRUE for a bet builder bet                                                                                        |
| sport\_gc\_bet\_amount                    | NUMERIC  | Sweepstakes: bet amount in gold coins (GC)                                                                        |
| sport\_sc\_bet\_amount                    | NUMERIC  | Sweepstakes: bet amount in SC coins                                                                               |

### dwh\_ext\_xxx.tr\_sport\_bet\_selection\_settled

Settled selections of sport bets. One row per selection.

**Joins:**

* sport\_last\_selection\_sport\_type → [dm\_sport\_type](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_sport_type) (smr\_sport\_type\_id)
* sport\_last\_selection\_league → [dm\_sport\_league](https://help.smartico.ai/pages/FwlimpzjSx9FROVnX5hH#dwh_ext_xxx.dm_sport_league) (smr\_sport\_league\_id)
* sport\_last\_bet\_type → [lookup\_sport\_last\_bet\_type](#text-of-value-ids) (id)
* sport\_last\_selection\_settlement\_status → [lookup\_sport\_last\_selection\_settlement\_status](#text-of-value-ids) (id)
* sport\_last\_selection\_bet\_status → [lookup\_sport\_last\_selection\_bet\_status](#text-of-value-ids) (id)
* sport\_last\_selection\_market → [lookup\_sport\_last\_selection\_market](#text-of-value-ids) (id)
* sport\_last\_selection\_home\_team → [lookup\_sport\_last\_selection\_home\_team](#text-of-value-ids) (id)
* sport\_last\_selection\_away\_team → [lookup\_sport\_last\_selection\_away\_team](#text-of-value-ids) (id)
* sport\_last\_selection\_competitors → [lookup\_sport\_last\_selection\_competitors](#text-of-value-ids) (id)
* sport\_last\_bet\_platform → [lookup\_sport\_last\_bet\_platform](#text-of-value-ids) (id)
* sport\_last\_bet\_provider → [lookup\_sport\_last\_bet\_provider](#text-of-value-ids) (id)

| Column                                     | Type      | Description                                                                                                                                                         |
| ------------------------------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sport\_last\_bet\_id                       | STRING    | ID of the bet in your platform. The same in the bet open, selection open, selection settled and bet settled views                                                   |
| sport\_last\_selection\_id                 | STRING    | ID of the selection in your platform                                                                                                                                |
| sport\_match\_id                           | STRING    | ID of the match                                                                                                                                                     |
| sport\_last\_bet\_amount                   | NUMERIC   | Bet amount for the whole bet (all selections), real and bonus money                                                                                                 |
| sport\_last\_bet\_amount\_real             | NUMERIC   | Bet amount, real money part                                                                                                                                         |
| sport\_last\_bet\_amount\_bonus            | NUMERIC   | Bet amount, bonus money part                                                                                                                                        |
| sport\_last\_bonus\_bet\_amount            | NUMERIC   | Bonus bet amount for the whole bet, as your platform reports it                                                                                                     |
| sport\_last\_selection\_bet\_amount        | NUMERIC   | Bet amount of this selection                                                                                                                                        |
| sport\_last\_original\_bet\_amount         | NUMERIC   | Bet amount in its original currency, not converted to the wallet currency                                                                                           |
| sport\_last\_original\_bet\_amount\_real   | NUMERIC   | Original-currency bet amount, real money part                                                                                                                       |
| sport\_last\_original\_bet\_amount\_bonus  | NUMERIC   | Original-currency bet amount, bonus money part                                                                                                                      |
| sport\_last\_selection\_odds               | NUMERIC   | Odds of this selection                                                                                                                                              |
| sport\_last\_max\_selection\_odds          | NUMERIC   | Highest odds among the selections of the bet                                                                                                                        |
| sport\_last\_min\_selection\_odds          | NUMERIC   | Lowest odds among the selections of the bet                                                                                                                         |
| sport\_last\_bet\_selection\_count         | NUMERIC   | Number of selections in the bet                                                                                                                                     |
| sport\_last\_bet\_type                     | INT64     | Type of the bet (for example single, combo or system). ID of a value; text in lookup\_sport\_last\_bet\_type                                                        |
| sport\_last\_selection\_settlement\_status | INT64     | Result of the selection. ID of a value; text in lookup\_sport\_last\_selection\_settlement\_status                                                                  |
| sport\_last\_selection\_bet\_status        | INT64     | Status of the whole bet when this selection was settled (for example won, lost, void, cash-out). ID of a value; text in lookup\_sport\_last\_selection\_bet\_status |
| sport\_last\_selection\_sport\_type        | INT64     | Sport of the selection. ID of a value; joins to dm\_sport\_type                                                                                                     |
| sport\_last\_selection\_league             | INT64     | League of the selection. ID of a value; joins to dm\_sport\_league                                                                                                  |
| sport\_last\_selection\_market             | INT64     | Market of the selection. ID of a value; text in lookup\_sport\_last\_selection\_market                                                                              |
| sport\_last\_selection\_home\_team         | INT64     | Home team. ID of a value; text in lookup\_sport\_last\_selection\_home\_team                                                                                        |
| sport\_last\_selection\_away\_team         | INT64     | Away team. ID of a value; text in lookup\_sport\_last\_selection\_away\_team                                                                                        |
| sport\_last\_selection\_competitors        | INT64\[]  | Competitors of the selection. IDs of values; text in lookup\_sport\_last\_selection\_competitors                                                                    |
| sport\_last\_bet\_platform                 | INT64     | Platform of the bet (for example web or mobile). ID of a value; text in lookup\_sport\_last\_bet\_platform                                                          |
| sport\_last\_bet\_provider                 | INT64     | Sportsbook provider. ID of a value; text in lookup\_sport\_last\_bet\_provider                                                                                      |
| sport\_original\_bet\_date                 | TIMESTAMP | Time when the bet was placed                                                                                                                                        |
| sport\_last\_selection\_is\_live           | BOOL      | TRUE for a live selection                                                                                                                                           |
| sport\_last\_selection\_virtual            | BOOL      | TRUE for a selection on a virtual sport                                                                                                                             |
| sport\_is\_bet\_builder                    | BOOL      | TRUE for a bet builder bet                                                                                                                                          |
| sport\_gc\_bet\_amount                     | NUMERIC   | Sweepstakes: bet amount in gold coins (GC)                                                                                                                          |
| sport\_gc\_win\_amount                     | NUMERIC   | Sweepstakes: win amount in gold coins (GC)                                                                                                                          |
| sport\_sc\_bet\_amount                     | NUMERIC   | Sweepstakes: bet amount in SC coins                                                                                                                                 |
| sport\_sc\_win\_amount                     | NUMERIC   | Sweepstakes: win amount in SC coins                                                                                                                                 |

### dwh\_ext\_xxx.tr\_sport\_bet\_settled

Settled sport bets. One row per bet.

**Joins:**

* sport\_last\_bet\_type → [lookup\_sport\_last\_bet\_type](#text-of-value-ids) (id)
* sport\_last\_bet\_timing → [lookup\_sport\_last\_bet\_timing](#text-of-value-ids) (id)
* sport\_last\_settlement\_status → [lookup\_sport\_last\_settlement\_status](#text-of-value-ids) (id)
* sport\_last\_bet\_sports → [lookup\_sport\_last\_bet\_sports](#text-of-value-ids) (id)
* sport\_last\_bet\_leagues → [lookup\_sport\_last\_bet\_leagues](#text-of-value-ids) (id)
* sport\_last\_bet\_markets → [lookup\_sport\_last\_bet\_markets](#text-of-value-ids) (id)
* sport\_last\_bet\_competitors → [lookup\_sport\_last\_bet\_competitors](#text-of-value-ids) (id)
* sport\_last\_bet\_match\_ids → [lookup\_sport\_last\_bet\_match\_ids](#text-of-value-ids) (id)
* sport\_last\_bet\_platform → [lookup\_sport\_last\_bet\_platform](#text-of-value-ids) (id)
* sport\_last\_bet\_provider → [lookup\_sport\_last\_bet\_provider](#text-of-value-ids) (id)
* acc\_last\_active\_currency → [lookup\_acc\_last\_active\_currency](#text-of-value-ids) (id)

| Column                                    | Type      | Description                                                                                                                                     |
| ----------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| sport\_last\_bet\_id                      | STRING    | ID of the bet in your platform. The same in the bet open, selection open, selection settled and bet settled views                               |
| sport\_match\_id                          | STRING    | ID of the match                                                                                                                                 |
| sport\_last\_bet\_amount                  | NUMERIC   | Bet amount for the whole bet (all selections), real and bonus money                                                                             |
| sport\_last\_bet\_amount\_real            | NUMERIC   | Bet amount, real money part                                                                                                                     |
| sport\_last\_bet\_amount\_bonus           | NUMERIC   | Bet amount, bonus money part                                                                                                                    |
| sport\_last\_bonus\_bet\_amount           | NUMERIC   | Bonus bet amount for the whole bet, as your platform reports it                                                                                 |
| sport\_last\_bet\_win\_amount             | NUMERIC   | Win amount, real and bonus money                                                                                                                |
| sport\_last\_bet\_win\_amount\_real       | NUMERIC   | Win amount, real money part                                                                                                                     |
| sport\_last\_bet\_win\_amount\_bonus      | NUMERIC   | Win amount, bonus money part                                                                                                                    |
| sport\_last\_bet\_profit                  | NUMERIC   | Player's result in real money: real win minus real bet                                                                                          |
| sport\_last\_bet\_profit\_total           | NUMERIC   | Player's result: total win minus total bet                                                                                                      |
| sport\_last\_original\_bet\_amount        | NUMERIC   | Bet amount in its original currency, not converted to the wallet currency                                                                       |
| sport\_last\_original\_bet\_amount\_real  | NUMERIC   | Original-currency bet amount, real money part                                                                                                   |
| sport\_last\_original\_bet\_amount\_bonus | NUMERIC   | Original-currency bet amount, bonus money part                                                                                                  |
| sport\_last\_original\_win\_amount        | NUMERIC   | Win amount in its original currency, not converted to the wallet currency                                                                       |
| sport\_last\_original\_win\_amount\_real  | NUMERIC   | Original-currency win amount, real money part                                                                                                   |
| sport\_last\_original\_win\_amount\_bonus | NUMERIC   | Original-currency win amount, bonus money part                                                                                                  |
| sport\_last\_bet\_odds                    | NUMERIC   | Odds of the bet                                                                                                                                 |
| sport\_last\_max\_selection\_odds         | NUMERIC   | Highest odds among the selections of the bet                                                                                                    |
| sport\_last\_min\_selection\_odds         | NUMERIC   | Lowest odds among the selections of the bet                                                                                                     |
| sport\_last\_bet\_selection\_count        | NUMERIC   | Number of selections in the bet                                                                                                                 |
| sport\_last\_bet\_type                    | INT64     | Type of the bet (for example single, combo or system). ID of a value; text in lookup\_sport\_last\_bet\_type                                    |
| sport\_last\_bet\_timing                  | INT64     | Live or pre-match. ID of a value; text in lookup\_sport\_last\_bet\_timing                                                                      |
| sport\_last\_settlement\_status           | INT64     | Final status of the bet (for example won, lost, void, cash-out, canceled). ID of a value; text in lookup\_sport\_last\_settlement\_status       |
| sport\_last\_bet\_sports                  | INT64\[]  | Sports of the selections. IDs of values; text in lookup\_sport\_last\_bet\_sports                                                               |
| sport\_last\_bet\_leagues                 | INT64\[]  | Leagues of the selections. IDs of values; text in lookup\_sport\_last\_bet\_leagues                                                             |
| sport\_last\_bet\_markets                 | INT64\[]  | Markets of the selections. IDs of values; text in lookup\_sport\_last\_bet\_markets                                                             |
| sport\_last\_bet\_competitors             | INT64\[]  | Competitors of the selections. IDs of values; text in lookup\_sport\_last\_bet\_competitors                                                     |
| sport\_last\_bet\_match\_ids              | INT64\[]  | Matches of the selections. IDs of values (text in lookup\_sport\_last\_bet\_match\_ids), not the match IDs; the match ID is in sport\_match\_id |
| sport\_last\_bet\_platform                | INT64     | Platform of the bet (for example web or mobile). ID of a value; text in lookup\_sport\_last\_bet\_platform                                      |
| sport\_last\_bet\_provider                | INT64     | Sportsbook provider. ID of a value; text in lookup\_sport\_last\_bet\_provider                                                                  |
| sport\_original\_bet\_date                | TIMESTAMP | Time when the bet was placed                                                                                                                    |
| sport\_last\_bet\_virtual                 | BOOL      | TRUE for a bet on a virtual sport                                                                                                               |
| sport\_is\_bet\_builder                   | BOOL      | TRUE for a bet builder bet                                                                                                                      |
| sport\_is\_free\_bet                      | BOOL      | TRUE for a free bet                                                                                                                             |
| sport\_is\_rollback                       | BOOL      | TRUE when the transaction cancels an earlier one. A rollback should carry negative amounts                                                      |
| core\_is\_exclude\_from\_report           | BOOL      | TRUE when your platform marked the transaction to be left out of reports                                                                        |
| acc\_last\_active\_currency               | INT64     | For players with several wallets: the currency of the active wallet. ID of a value; text in lookup\_acc\_last\_active\_currency                 |
| acc\_real\_balance                        | NUMERIC   | Real money balance after the transaction, as your platform reports it                                                                           |
| acc\_bonus\_balance                       | NUMERIC   | Bonus money balance after the transaction, as your platform reports it                                                                          |
| acc\_land\_balance\_real                  | NUMERIC   | Land-based (retail) wallet: real money balance                                                                                                  |
| acc\_land\_balance\_bonus                 | NUMERIC   | Land-based (retail) wallet: bonus balance                                                                                                       |
| acc\_land\_balance\_total                 | NUMERIC   | Land-based (retail) wallet: total balance                                                                                                       |
| sport\_gc\_bet\_amount                    | NUMERIC   | Sweepstakes: bet amount in gold coins (GC)                                                                                                      |
| sport\_gc\_win\_amount                    | NUMERIC   | Sweepstakes: win amount in gold coins (GC)                                                                                                      |
| sport\_sc\_bet\_amount                    | NUMERIC   | Sweepstakes: bet amount in SC coins                                                                                                             |
| sport\_sc\_win\_amount                    | NUMERIC   | Sweepstakes: win amount in SC coins                                                                                                             |

Bets settled on the previous day, with the time they were placed (from the bet open view)

```sql
WITH opened AS (
  SELECT user_id, sport_last_bet_id, MIN(event_time) AS opened_at
  FROM dwh_ext_xxx.tr_sport_bet_open
  WHERE event_time >= TIMESTAMP_SUB(TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), DAY), INTERVAL 31 DAY)
  GROUP BY user_id, sport_last_bet_id
)
SELECT S.user_id, S.sport_last_bet_id, O.opened_at, S.event_time AS settled_at,
       S.sport_last_bet_amount, S.sport_last_bet_win_amount
FROM dwh_ext_xxx.tr_sport_bet_settled S
LEFT JOIN opened O ON O.user_id = S.user_id AND O.sport_last_bet_id = S.sport_last_bet_id
WHERE S.event_time >= TIMESTAMP_TRUNC(TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY), DAY)
  AND S.event_time < TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), DAY)
LIMIT 1000
```

## Bonuses (from PAM)

These views hold bonuses as your platform reports them. Bonuses that Smartico gives are on the [Transactional views, System](https://help.smartico.ai/welcome/technical-guides/smartico-data-warehouse/smartico-dwh-transactional-views-system.md) page.

### dwh\_ext\_xxx.tr\_acc\_bonus\_given

Bonuses given to players. One row per bonus.

**Joins:**

* acc\_last\_original\_bonus\_currency → [lookup\_acc\_last\_original\_bonus\_currency](#text-of-value-ids) (id)
* acc\_last\_bonus\_type → [lookup\_acc\_last\_bonus\_type](#text-of-value-ids) (id)
* acc\_bonus\_state → [lookup\_acc\_bonus\_state](#text-of-value-ids) (id)

| Column                               | Type    | Description                                                                                                |
| ------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------- |
| acc\_last\_transaction\_id           | STRING  | ID of the transaction in your platform                                                                     |
| acc\_last\_bonus\_amount             | NUMERIC | Bonus amount                                                                                               |
| acc\_last\_original\_bonus\_amount   | NUMERIC | Bonus amount in its original currency, not converted to the wallet currency                                |
| acc\_last\_original\_bonus\_currency | INT64   | Currency of the original bonus amount. ID of a value; text in lookup\_acc\_last\_original\_bonus\_currency |
| acc\_last\_bonus\_name               | STRING  | Name of the bonus                                                                                          |
| acc\_last\_bonus\_code               | STRING  | Bonus code                                                                                                 |
| acc\_last\_bonus\_type               | INT64   | Type of the bonus. ID of a value; text in lookup\_acc\_last\_bonus\_type                                   |
| acc\_bonus\_state                    | INT64   | State of the bonus (for example active or suspended). ID of a value; text in lookup\_acc\_bonus\_state     |
| acc\_utm\_value                      | STRING  | UTM marker that shows the marketing source of the transaction                                              |
| acc\_gc\_last\_bonus\_amount         | NUMERIC | Sweepstakes: gold coins (GC) amount of the bonus                                                           |
| acc\_sc\_last\_bonus\_amount         | NUMERIC | Sweepstakes: SC coins amount of the bonus                                                                  |

### dwh\_ext\_xxx.tr\_acc\_bonus\_approved

Approved bonuses. One row per bonus.

**Joins:**

* acc\_last\_original\_bonus\_currency → [lookup\_acc\_last\_original\_bonus\_currency](#text-of-value-ids) (id)
* acc\_last\_bonus\_type → [lookup\_acc\_last\_bonus\_type](#text-of-value-ids) (id)
* acc\_bonus\_state → [lookup\_acc\_bonus\_state](#text-of-value-ids) (id)

| Column                               | Type    | Description                                                                                                |
| ------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------- |
| acc\_last\_transaction\_id           | STRING  | ID of the transaction in your platform                                                                     |
| acc\_last\_bonus\_amount             | NUMERIC | Bonus amount                                                                                               |
| acc\_last\_original\_bonus\_amount   | NUMERIC | Bonus amount in its original currency, not converted to the wallet currency                                |
| acc\_last\_original\_bonus\_currency | INT64   | Currency of the original bonus amount. ID of a value; text in lookup\_acc\_last\_original\_bonus\_currency |
| acc\_last\_bonus\_release\_amount    | NUMERIC | Released amount of the bonus, as your platform reports it                                                  |
| acc\_last\_bonus\_name               | STRING  | Name of the bonus                                                                                          |
| acc\_last\_bonus\_code               | STRING  | Bonus code                                                                                                 |
| acc\_last\_bonus\_type               | INT64   | Type of the bonus. ID of a value; text in lookup\_acc\_last\_bonus\_type                                   |
| acc\_bonus\_state                    | INT64   | State of the bonus (for example active or suspended). ID of a value; text in lookup\_acc\_bonus\_state     |
| acc\_utm\_value                      | STRING  | UTM marker that shows the marketing source of the transaction                                              |
| acc\_real\_balance                   | NUMERIC | Real money balance after the transaction, as your platform reports it                                      |
| acc\_bonus\_balance                  | NUMERIC | Bonus money balance after the transaction, as your platform reports it                                     |
| acc\_land\_balance\_real             | NUMERIC | Land-based (retail) wallet: real money balance                                                             |
| acc\_land\_balance\_bonus            | NUMERIC | Land-based (retail) wallet: bonus balance                                                                  |
| acc\_land\_balance\_total            | NUMERIC | Land-based (retail) wallet: total balance                                                                  |
| acc\_gc\_last\_bonus\_amount         | NUMERIC | Sweepstakes: gold coins (GC) amount of the bonus                                                           |
| acc\_sc\_last\_bonus\_amount         | NUMERIC | Sweepstakes: SC coins amount of the bonus                                                                  |

### dwh\_ext\_xxx.tr\_acc\_bonus\_cancelled

Canceled bonuses. One row per bonus.

**Joins:**

* acc\_last\_original\_bonus\_currency → [lookup\_acc\_last\_original\_bonus\_currency](#text-of-value-ids) (id)
* acc\_last\_bonus\_type → [lookup\_acc\_last\_bonus\_type](#text-of-value-ids) (id)
* acc\_bonus\_state → [lookup\_acc\_bonus\_state](#text-of-value-ids) (id)
* acc\_last\_bonus\_cancel\_reason → [lookup\_acc\_last\_bonus\_cancel\_reason](#text-of-value-ids) (id)

| Column                               | Type    | Description                                                                                                |
| ------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------- |
| acc\_last\_bonus\_amount             | NUMERIC | Bonus amount                                                                                               |
| acc\_last\_original\_bonus\_amount   | NUMERIC | Bonus amount in its original currency, not converted to the wallet currency                                |
| acc\_last\_original\_bonus\_currency | INT64   | Currency of the original bonus amount. ID of a value; text in lookup\_acc\_last\_original\_bonus\_currency |
| acc\_last\_bonus\_name               | STRING  | Name of the bonus                                                                                          |
| acc\_last\_bonus\_code               | STRING  | Bonus code                                                                                                 |
| acc\_last\_bonus\_type               | INT64   | Type of the bonus. ID of a value; text in lookup\_acc\_last\_bonus\_type                                   |
| acc\_bonus\_state                    | INT64   | State of the bonus (for example active or suspended). ID of a value; text in lookup\_acc\_bonus\_state     |
| acc\_last\_bonus\_cancel\_reason     | INT64   | Reason of the cancellation. ID of a value; text in lookup\_acc\_last\_bonus\_cancel\_reason                |
| acc\_gc\_last\_bonus\_amount         | NUMERIC | Sweepstakes: gold coins (GC) amount of the bonus                                                           |
| acc\_sc\_last\_bonus\_amount         | NUMERIC | Sweepstakes: SC coins amount of the bonus                                                                  |

### dwh\_ext\_xxx.tr\_acc\_bonus\_failed

Bonuses that failed. One row per bonus.

**Joins:**

* acc\_last\_original\_bonus\_currency → [lookup\_acc\_last\_original\_bonus\_currency](#text-of-value-ids) (id)
* acc\_last\_bonus\_type → [lookup\_acc\_last\_bonus\_type](#text-of-value-ids) (id)
* acc\_bonus\_state → [lookup\_acc\_bonus\_state](#text-of-value-ids) (id)
* acc\_last\_bonus\_failed\_reason → [lookup\_acc\_last\_bonus\_failed\_reason](#text-of-value-ids) (id)

| Column                               | Type    | Description                                                                                                |
| ------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------- |
| acc\_last\_bonus\_amount             | NUMERIC | Bonus amount                                                                                               |
| acc\_last\_original\_bonus\_amount   | NUMERIC | Bonus amount in its original currency, not converted to the wallet currency                                |
| acc\_last\_original\_bonus\_currency | INT64   | Currency of the original bonus amount. ID of a value; text in lookup\_acc\_last\_original\_bonus\_currency |
| acc\_last\_bonus\_name               | STRING  | Name of the bonus                                                                                          |
| acc\_last\_bonus\_code               | STRING  | Bonus code                                                                                                 |
| acc\_last\_bonus\_type               | INT64   | Type of the bonus. ID of a value; text in lookup\_acc\_last\_bonus\_type                                   |
| acc\_bonus\_state                    | INT64   | State of the bonus (for example active or suspended). ID of a value; text in lookup\_acc\_bonus\_state     |
| acc\_last\_bonus\_failed\_reason     | INT64   | Reason of the failure. ID of a value; text in lookup\_acc\_last\_bonus\_failed\_reason                     |
| acc\_gc\_last\_bonus\_amount         | NUMERIC | Sweepstakes: gold coins (GC) amount of the bonus                                                           |
| acc\_sc\_last\_bonus\_amount         | NUMERIC | Sweepstakes: SC coins amount of the bonus                                                                  |

Bonuses given on the previous day, per bonus name, in the label currency

```sql
SELECT acc_last_bonus_name,
       COUNT(*) AS bonuses,
       SUM(SAFE_DIVIDE(acc_last_bonus_amount, user_to_label_cur_rate)) AS amount_label_currency
FROM dwh_ext_xxx.tr_acc_bonus_given
WHERE event_time >= TIMESTAMP_TRUNC(TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY), DAY)
  AND event_time < TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), DAY)
GROUP BY acc_last_bonus_name
ORDER BY bonuses DESC
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.smartico.ai/welcome/technical-guides/smartico-data-warehouse/smartico-dwh-transactional-views-pam.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
