QUERY PLAN
Aggregate (cost=24.28..24.29 rows=1 width=32)
-> Hash Join (cost=2.68..22.56 rows=686 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.39..2.39 rows=23 width=4)
-> Seq Scan on tbl_erp_other_collect_tickets t (cost=0.00..2.39 rows=23 width=4)
Filter: ((created_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2))