大虾帮忙,数查询,急!!!!(50)

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

wisdomphg

Unregistered / Unconfirmed
GUEST, unregistred user!
数据表aaaa bb cc dd ds 1001 5 5ds 1001 4 3ds 1001 6 6ds 1001 2 1查询的结果是:aa bb cc dd eeds 1001 4 3 1ds 1001 2 1 1就是说字段CC-DD大于0的才显示
 
Select aa, bb, cc, dd, cc - dd ee From Ta Where cc - dd > 0
 
我试过没用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;
 
二楼是对的啊,怎么会没用?没用你再加一个select * from (Select aa, bb, cc, dd, cc - dd ee From Ta) awhere ee > 0
 
多人接受答案了。
 

Similar threads

D
回复
0
查看
923
DelphiTeacher的专栏
D
D
回复
0
查看
715
DelphiTeacher的专栏
D
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
后退
顶部