diff --git a/queries/orderbook/barn_batch_rewards.sql b/queries/orderbook/barn_batch_rewards.sql index bb86f554..1f259aea 100644 --- a/queries/orderbook/barn_batch_rewards.sql +++ b/queries/orderbook/barn_batch_rewards.sql @@ -25,7 +25,9 @@ order_data as ( kind, app_data from orders - union all + union distinct -- A _distinct_ union is needed since orders can appear in the normal orders + -- table and in the jit orders table. Since the uid is otherwise unique, no valid order is + -- removed by the _distinct_ union. select uid, sell_token, diff --git a/queries/orderbook/order_data.sql b/queries/orderbook/order_data.sql index a7e4f6ab..90661910 100644 --- a/queries/orderbook/order_data.sql +++ b/queries/orderbook/order_data.sql @@ -36,7 +36,9 @@ order_data as ( kind, app_data from orders - union all + union distinct -- A _distinct_ union is needed since orders can appear in the normal orders + -- table and in the jit orders table. Since the uid is otherwise unique, no valid order is + -- removed by the _distinct_ union. select uid, sell_token, diff --git a/queries/orderbook/prod_batch_rewards.sql b/queries/orderbook/prod_batch_rewards.sql index cc6f2e55..e2aa5839 100644 --- a/queries/orderbook/prod_batch_rewards.sql +++ b/queries/orderbook/prod_batch_rewards.sql @@ -25,7 +25,9 @@ order_data as ( kind, app_data from orders - union all + union distinct -- A _distinct_ union is needed since orders can appear in the normal orders + -- table and in the jit orders table. Since the uid is otherwise unique, no valid order is + -- removed by the _distinct_ union. select uid, sell_token,