Spending above income x1.5: mass, EUR, 6 mo.: Feb–Jul 2025
Instructions
Consider transactions on accounts in the currency EUR (accounts.currency) with tx_time on or after February 1, 2025 and strictly before August 1, 2025. A client's income is the sum of transactions with amount > 0, and spending is the sum of the absolute values of transactions with amount < 0 (that is, -sum(amount)); all such accounts of the client are taken. Find clients of the segment 'mass' who had both income and spending, and whose spending is strictly greater than their income, multiplied by 1.5. Output id, name, income and spend. Row order does not matter.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Table relationships
- N:1Many-to-one
accounts.→client_id clients.id - N:1Many-to-one
transactions.→account_id accounts.id
Table data
Select a table in the diagram or list to view its rows.