You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SQL command to find workspaces with balances different than the sum of workspace transactions:
select
ph.workspace_uuid,
w.name,
SUM(case when payment_type = 'withdraw' THEN amount * -1 ELSE amount END) as amount,
bb.total_budget,
MAX(ph.updated) as last_transaction,
MIN(ph.updated) as first_transaction
from payment_histories as ph
inner join workspaces as w on w.uuid = ph.workspace_uuid
inner join bounty_budgets as bb on bb.workspace_uuid = ph.workspace_uuid
WHERE status = true
GROUP BY ph.workspace_uuid, w.name, bb.total_budget
HAVING SUM(case when payment_type = 'withdraw' THEN amount * -1 ELSE amount END) <> total_budget
ORDER by amount DESC
Task
SQL qeury:
The text was updated successfully, but these errors were encountered: