QUERY PLAN
Aggregate (cost=10.12..10.13 rows=1 width=32)
-> Hash Right Join (cost=4.12..10.11 rows=4 width=5)
Hash Cond: (eipss.erp_sales_gift_id = t.id)
-> Seq Scan on tbl_erp_inventory_product_spents eipss (cost=0.00..5.36 rows=236 width=9)
-> Hash (cost=4.10..4.10 rows=1 width=4)
-> Seq Scan on tbl_erp_sales_gifts t (cost=0.00..4.10 rows=1 width=4)
Filter: ((created_at >= '2025-12-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2))