本帖最后由 sukk 于 2013-08-12 20:28:43 编辑

解决方案 »

  1.   

    mysql> select distinct(tb1.id) from tb1 left join tb2 on
    tb1.id=tb2.mid left join tb3 on tb1.id=tb3.mid where bm.date >= 1376236
    908 or hl.date >= 1376236908 ;
    +-------+
    | id    |
    +-------+
    | 11877 |
    +-------+
    1 row in set (1.94 sec)mysql>
      

  2.   

    select * from tb1 A,tb2 B where A.id=B.mid and B.date>=1376236802;
    union all
    select * from tb1 A,tb3 B where A.id=B.mid and C.date>=1376236802;tb2,tb3上date列上加索引
      

  3.   

    select a.*
    from tb1 a,(
       select mid from tb2 where date >= 1376236802
       union all 
       select mid from tb3 where date >=1376236802) b
    where a.id=b.mid;create index xxx1 on tb1(id);
    create index xxx2 on tb2(date);
    create index xxx3 on tb3(date);