QUERY PLAN
Aggregate (cost=12.90..12.91 rows=1 width=32)
-> Nested Loop (cost=0.01..12.89 rows=1 width=64)
Join Filter: (tbl_erp_cash_cost_tickets.reimbursement_id = id)
-> Seq Scan on tbl_erp_cash_cost_tickets (cost=0.00..12.85 rows=1 width=68)
Filter: ((settle_amount < amount) AND (status = 2))
-> Unique (cost=0.01..0.02 rows=1 width=4)
-> Group (cost=0.01..0.02 rows=1 width=4)
Group Key: id
-> Sort (cost=0.01..0.02 rows=0 width=4)
Sort Key: id
-> Result (cost=0.00..0.00 rows=0 width=4)
One-Time Filter: false