-- active-users report query
select u.user_id,u.user_name,o.order_id,o.amount
from t_user u
join t_order o on u.user_id = o.user_id
where u.status = 'active'
  and o.created_at > sysdate - 30
  and o.amount > 100
ORDER BY o.amount desc
