我试过没用SqlText := 'select DINGD_NO as ''生产编号'',ehw_pici as ''生产批次'',max(ehw_ddqty) as ''订单量'',max(ehw_outdate) as ''计划出货日期'',ehw_xiadate as ''下单日期'',max(ehw_xiaqty) as ''下单数量'','; SqlText := SqlText+'max(ehw_zgs) as ''个取数'',max(ehw_pian) as ''片取数'',max(gongx_noa) as ''工序代码'',gongx_no as ''工序名称'',ehw_lot as ''LOT号'',sum(ehw_inqty) as ''工序入'',sum(ehw_outqty) as ''工序出'',sum(ehw_inqty-ehw_outqty) as ''在线数'', '; SqlText := SqlText+'EHW_PIANQTY as ''片/LOT'' from ehw where '; SqlText := SqlText+' dingd_no='''+DBGridEH1.Fields[0].DisplayText+''' '; SqlText := SqlText+' and ehw_pici='''+DBGridEH1.Fields[1].DisplayText+''' '; SqlText := SqlText+' and gongx_noa='''+edit3.Text+''' '; // SqlText := SqlText+' and '''+qytemp.Fields[13].Value+'''<>0 '; SqlText := SqlText+' GROUP BY DINGD_NO,ehw_pici,gongx_noa,ehw_lot,ehw_xiadate,gongx_no,EHW_PIANQTY'; SqlText := SqlText+' order by ehw_lot,gongx_noa'; ExeSql(qytemp,SqlText,0); Animate1.Active := False; GroupBox2.Visible := False;