COALESCE(规格,' ') 或者 COALESCE(规格,0) select * from ( ) 客户,() 物料号,p4.name 内部批次,p4.outsidename 外部批次,p1.库存,p5.总库存 FROM (SELECT SUM(qty) 存量,product_id,lot_id FROM stock_kqty p1 WHERE location_id=${仓} GROUP BY product_id,lot_id) p1 LEFT JOIN product_code p2