QUERY PLAN
Aggregate (cost=2.04..2.05 rows=1 width=32)
-> Nested Loop (cost=0.00..2.04 rows=1 width=32)
Join Filter: (esrps.erp_sales_return_id = t.id)
-> Seq Scan on tbl_erp_sales_return_products esrps (cost=0.00..1.01 rows=1 width=36)
-> Seq Scan on tbl_erp_sales_returns t (cost=0.00..1.01 rows=1 width=4)
Filter: (status = 2)