可能说法不对,表A和B,是1:1关系,A的主键和B的主键是一样的,本来是一张表,因为字段太多,拆成2张表了,现在查询想把2张表的字段连起来,用的INNER JOIN 方法数据比较多,查询时间比较长,除了INNER JOIN 方法还有其他方法吧遮阳得个表字段联合起来吗?select 字段 from a inner join b on a.id=b.id

解决方案 »

  1.   

    select 字段 from a inner join b on a.id=b.id
    这个以是简便了....
      

  2.   

    这个已经很简便啦
    select 字段 from a inner join b on a.id=b.id
    对2个表的字段加索引create index IX_ID on b (id)
    create index IX_ID on A (id)
      

  3.   

    select 字段 from a inner join b on a.id=b.id这已经是最高效的方法了!
      

  4.   

    select 字段 from a 
    inner join b on a.id=b.id这样 行吗?select * from a,b where a.id = b.id
      

  5.   

    这个更简单!
    select * from a,b where a.id = b.id
     把分给我吧 谢谢
      

  6.   

    htl258,这个应该不是字段连接吧,呵呵
    其实lz的已经是比较简洁办法了,加上索引在执行效率上可能有所提高,不过数据量不大的话体现不出来
      

  7.   

    五楼的:
    select * from a,b where a.id = b.id
    这样写不可取,性能更是差,
    还是用INNER JOIN 好啊
      

  8.   

    不可以用union吧
    INNER JOIN 就好了呀!