QUERY PLAN
Aggregate (cost=14.64..14.65 rows=1 width=8)
-> Append (cost=0.00..14.63 rows=2 width=0)
-> Subquery Scan on "*SELECT* 1" (cost=0.00..13.16 rows=1 width=0)
-> Seq Scan on tbl_erp_advance_payment_tickets (cost=0.00..13.15 rows=1 width=198)
Filter: ((un_paid_amount > '0'::numeric) AND (status = 2) AND (supplier_id = 431))
-> Subquery Scan on "*SELECT* 2" (cost=0.00..1.47 rows=1 width=0)
-> Seq Scan on tbl_erp_other_collect_tickets (cost=0.00..1.46 rows=1 width=198)
Filter: ((status = 2) AND (supplier_id = 431) AND ((amount - settle_amount) > '0'::numeric))