QUERY PLAN
Limit (cost=80.80..80.80 rows=1 width=89)
-> Group (cost=80.80..80.80 rows=1 width=89)
Group Key: esops.id
-> Sort (cost=80.80..80.80 rows=1 width=89)
Sort Key: esops.id
-> Nested Loop (cost=0.00..80.79 rows=1 width=89)
Join Filter: (esops.product_id = eips.product_id)
-> Seq Scan on tbl_erp_sales_order_products esops (cost=0.00..65.80 rows=1 width=89)
Filter: ((erp_sales_order_id = 1715) AND ((number - outbound) > '0'::numeric))
-> Seq Scan on tbl_erp_inventory_products eips (cost=0.00..14.39 rows=48 width=4)
Filter: (inventory > '0'::numeric)