SQL交叉查询后字段为0不显示(50)

  • 主题发起人 主题发起人 wisdomphg
  • 开始时间 开始时间
W

wisdomphg

Unregistered / Unconfirmed
GUEST, unregistred user!
SqlText := 'select DINGD_NO ,ehw_pici ,gongx_noa,gongx_no,ehw_lot,ehw_xiadate,sum(ehw_inqty) as inqty,sum(ehw_outqty) as outqty,sum(ehw_inqty-ehw_outqty) as inout from ehw where '; SqlText := SqlText+' dingd_no>='''+ComboEdit1.Text+''' '; SqlUnion(SqlText,SqlDes,'dingd_no','生产编号',ComboEdit2.Text,'<=',0); SqlUnion(SqlText,SqlDes,'ehw_pici','生产批次',ComboEdit3.Text,'>=',0); SqlUnion(SqlText,SqlDes,'ehw_pici','生产批次',ComboEdit4.Text,'<=',0); SqlUnion(SqlText,SqlDes,'ehw_LOT','LOT号',ComboEdit9.Text,'>=',0); SqlUnion(SqlText,SqlDes,'ehw_LOT','LOT号',ComboEdit10.Text,'<=',0); SqlUnion(SqlText,SqlDes,'gongx_no','工序',ComboEdit5.Text,'>=',0); SqlUnion(SqlText,SqlDes,'gongx_no','工序',ComboEdit6.Text,'<=',0); SqlUnion(SqlText,SqlDes,'gongx_noa','工序代码',ComboEdit7.Text,'>=',0); SqlUnion(SqlText,SqlDes,'gongx_noa','工序代码',ComboEdit8.Text,'<=',0); SqlUnion(SqlText,SqlDes,'ehw_xiadate','下单日期',DateEdit1.Text,'>=',2); SqlUnion(SqlText,SqlDes,'ehw_xiadate','下单日期',DateEdit2.Text,'<=',2); SqlText := SqlText+' GROUP BY DINGD_NO,ehw_pici,gongx_noa,ehw_lot,ehw_xiadate,gongx_no'; SqlText := SqlText+' order by dingd_no,ehw_pici,ehw_lot,gongx_noa'; ExeSql(MAST,SqlText,0);我要的是sum(ehw_inqty-ehw_outqty) as inout结果为0的记录不显示出来
 
建议你参考:http://school.itzcn.com/special-spid-48.html
 
后退
顶部