我想把 从几三个字段查询出来的结果,中间加上“->”,形成一个列
怎么实现
如:
字段1的值->字段2的值->字段3的值

解决方案 »

  1.   

    select 字段1 +'->' + 字段2 + '->' + 字段3 as a from table
      

  2.   

    select me.TSZ2901,ffather.TSZ2902,father.TSZ2902,me.TSZ2902 from TSZ29 me,TSZ29 father,TSZ29 ffather where me.TSZ2900=115 and me.TSZ2908=father.TSZ2900 and father.TSZ2908=ffather.TSZ2900两次自身连接,上面正确,下面出错select me.TSZ2901,ffather.TSZ2902+'->'+father.TSZ2902+'->'+me.TSZ2902 as department from TSZ29 me,TSZ29 father,TSZ29 ffather where me.TSZ2900=115 and me.TSZ2908=father.TSZ2900 and father.TSZ2908=ffather.TSZ2900
      

  3.   

    把sql语句赋给控件的那段贴出来
    可能你的  -〉引号不对
      

  4.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      s:String;
    begin
    Adoquery1.Close;
    Adoquery1.SQL.Clear;
    s:= 'select fname + ' +QuotedStr('-> ')
       + '+ lname + ' + QuotedStr('->')
       + '+ lname' + ' as a from employee';
    Adoquery1.SQL.Add(s);
    Adoquery1.Open;
    end;
      

  5.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      s:String;
    begin
    Adoquery1.Close;
    Adoquery1.SQL.Clear;
    s:= 'select me.TSZ2901,ffather.TSZ2902 + ' +QuotedStr('-> ')
       + '+ father.TSZ2902 + ' + QuotedStr('->')
       + '+ me.TSZ2902 as department from TSZ29 me,TSZ29 father,TSZ29 ffather 
       + ' where me.TSZ2900=115 and me.TSZ2908=father.TSZ2900 and'
       + ' father.TSZ2908=ffather.TSZ2900';
    Adoquery1.SQL.Add(s);
    Adoquery1.Open;
    end;