我想实现一个SQL的嵌套查询,就像select * form select * form tablename ,不知道在delphi中如何实现,BDE并不支持这类的嵌套.

解决方案 »

  1.   

    SQLSERVER支持嵌套
    MYSQL不支持.
    其他我就不清楚了
    1:
    select * from table1
    where field1 in (select field1 from table2)
    2:
    insert into table1
    select * from table2  //table1与table2的字段应该完全相同
    一般我把这个用于临时表
      

  2.   

    select * from (select * from table_name) as a
    FOR SQL SERVER
      

  3.   

    我的数据库是BDE,不能像SQL SERVER那样直接嵌套,但是我也不想在数据库中添加一个临时表,能有其它方法吗?各位高人帮忙啊.
      

  4.   

    a6mm的1.还是有启发的,让我试试先
      

  5.   

    嘻~windindance(风舞轻扬) ( ) 
    select * from (select * from table_name) as a
    FOR SQL SERVER
    你写的那个实现什么呀?
    我不怎么明白
      

  6.   

    with temp as (select * from a) select * from temp
      

  7.   

    多个表:
    with temp1 as (select * from a),with temp2 as (select * from b)   select * from temp1,temp2 where temp1.id=temp2.id
      

  8.   

    a6mm:
    select * from (select * from table_name) as a
    --这是一个查询,把其查询结果作为一个临时数据表进行查询。
      

  9.   

    windindance,BDE不支持select * from (select * from table_name) as a
      

  10.   

    windindance:
    with temp as (select * from a) select * from temp是什么?sql 语句?
      

  11.   

    weitao999:
    with temp as (select * from a) select * from temp是什么?sql 语句?
      

  12.   

    redwj:
    你说的BDE是什么意思?
    BDE是一种连接方法,不是一种数据库。
    你使用的什么数据库?不同的数据库有不同的实现方法。
    我的实现方法是for sql server的。
    如果你是想在db或者dbf数据库上使用类似的方法,很遗憾,据我所知是没有的。