表:t1,结构为:
id char(4),
num int
如记录:
0001,100
0001,99
0001,99
........
0001,70    
现在要查询出结果:
id    no1  no2  no3.......no10
0001  100  99   99.........70怎么写啊??有什么好的建议??

解决方案 »

  1.   

    建立临时表,然后insert,最后group by id.
      

  2.   

    access  能不能创建临时表,如能,怎么建立???
      

  3.   

    select top 10 * from t1 order by id
      

  4.   

    ft,你这张表记录不唯一阿!
    1 用新建id自增长字段用来标志行
      或用其他表做中间表2 用游标操作
      

  5.   

    只能动态建立临时表了,利用id的行号来做字段的title, 参考一下‘超级猛料’上面有建立临时表的例子
      

  6.   

    的确这张表记录不唯一,如果要改,先在数据库中加一个非空、自增的字段来标识唯一的记录然后用group by命令应该就可以了~
      

  7.   

    哪位仁兄可以告诉我如何知道ADO表是否存在啊,就是检查ADO表是否存在,哪位可以发短消息告诉我吗!
      

  8.   

    with Query1 do begin
      Close;  
      sql.clear;
      sql.add(' select distinct id ');
      with query2 do begin
        Close;
        SQL.Text:='select num from tl order by num ';
        Open;
        i:=1;
        while not eof do begin
          query1.SQL.Add(', '+fieldbyname('num').AsString+' as no'+inttostr(i)); 
          i:=i+1;
          Next;
        end;
      end;  
      SQL.Add(' from tl ');
      Open;
    end;
      

  9.   

    to  qlq111213,你的结果是:
    id     no1.......no10
    0001  100 ......100
    0001  99.........99