select t1.id, t2.id from t1,t2 where t1.id=t2.id

解决方案 »

  1.   

    不改sql的情况下有办法区分吗? 
      

  2.   

    如果你写成select * from t2,t1 where t1.id=t2.id 这样的话,结果中前面的就是t2的,后面的就是t1的.
      

  3.   

    取出字段的顺序和from table1, table2的顺序是一样的,哪个在前,记录就是属于哪个表的。
    不过当有这样相同表结构的时候,建议用别名。
    如 select table1.id as t1id, table2.id as t2id from table1, table2 where table1.id = table2.id