QUERY PLAN
Aggregate (cost=24.75..24.76 rows=1 width=32)
-> Hash Join (cost=3.15..23.03 rows=688 width=32)
Hash Cond: (r.erp_other_collect_ticket_id = t.id)
-> Seq Scan on tbl_erp_other_collect_ticket_payments r (cost=0.00..17.80 rows=776 width=36)
Filter: (erp_advance_payment_ticket_id IS NOT NULL)
-> Hash (cost=2.66..2.66 rows=39 width=4)
-> Seq Scan on tbl_erp_other_collect_tickets t (cost=0.00..2.66 rows=39 width=4)
Filter: ((created_at <= '2026-06-30 23:59:59+08'::timestamp with time zone) AND (status = 2))