在mysql4中可以
SELECT ....
UNION [ALL]
SELECT ....
  [UNION
   SELECT ...]
在mysql4以下版本只能这样了
CREATE TEMPORARY TABLE tmp
SELECT field1_index, field2_index FROM test_table WHERE field1_index = '1';
INSERT INTO tmp
SELECT field1_index, field2_index FROM test_table WHERE field2_index = '1';
SELECT * from tmp;
DROP TABLE tmp;

解决方案 »

  1.   

    可以把select的内容插到tmp表中,一切用select的内容限制
      

  2.   

    ReplaceInto tabel1 (col1,col2,col3,) Select col1,col2,col3 from tabel2
      

  3.   

    用内联和左联。
    要看你的具体需求,你最好把你的目地表达的更清楚一点,比如你要把A表的某某字段和B表的某某字段合到一个结果集中,A表和B表之间的关系。
      

  4.   

    table1
    id row1 row2 row3 row4 row5table2
    id r1 r2 r3 r4其中table1.row5和table2.r4是一样的,查询要求是row5和r4都为5,而且要得到row1,row2,row3,r2,r3的值,请问这个SQL怎么写呢?
      

  5.   

    select table1.row1,table1.row2,table1.row3,table2.r2,table2.r3 from table1,table2 where table1.row5=table2.r4 and table1.row5=5;