我有一个SQL查询的示例 请给我电子邮件,[email protected]

解决方案 »

  1.   

    case i do 
    0:str:='select * form ..'
    0:str:='select * form ..'
    0:str:='select * form ..'
    0:str:='select * form ..'
    end
    query add(str)...
    此法如何??
      

  2.   

    var
      str:string;
    begin
      str:='';
      FrmPopedFind:=TFrmPopedFind.Create(self);
      if FrmPopedFind.ShowModal=mrOk then
      begin                                                   
               //ModalResult
        if FrmPopedFind.edit1.Text<>'' then
          str:=str+'a.UserId like '+'''%'+FrmPopedFind.edit1.Text+'%'''+' and ';
        if FrmPopedFind.edit2.Text<>'' then
          str:=str+'a.dept like '+'''%'+FrmPopedFind.edit2.Text+'%'''+' and ';
        if FrmPopedFind.edit3.Text<>'' then
          str:=str+'a.name like '+'''%'+FrmPopedFind.edit3.Text+'%'''+' and ';
        if str='' then
          exit
        else
          str:=(copy(str,1,length(str)-5));    with AQuery1 do
        begin
          close;
          sql.Clear;     
          sql.Add('select *'+
                  ' from login a,popedom b'+
                  ' where '+str+' and a.pGroup=b.pGroup');
          open;
        end;
      end;
      FrmPopedFind.Free;
    end;
      

  3.   

    我有一个SQL查询的示例 请给我电子邮件,[email protected]