数据库用的是SQL SERVER,模拟一个仓库管理系统,要输出库存和需要量的差,并输出缺货单,这样的SQL语句应怎么写?delphi如何实现??

解决方案 »

  1.   

    var 
      _younum:integer;
    begin
      _yournum := StrToIntDef(Edit1.Text,0);
      with adoquery1 do
      begin
        close;
        SQL.text := 'select kcsl,kcsl-'+IntToStr(_yournum)+' as diffnum from kctable where kcsl<' +IntToStr(_yournum);
        Open;
        .....
                    
      end;
    end;
      

  2.   

    var 
      _younum:integer;
    begin
      _yournum := StrToIntDef(Edit1.Text,0);
      with adoquery1 do
      begin
        close;
        SQL.text := 'select kcsl,kcsl-'+IntToStr(_yournum)+' as diffnum from kctable where kcsl<' +IntToStr(_yournum)+'';
        Open;
        .....
                    
      end;
    end;