select * from table_1,table_2,table_3 where table_1.date=table_2.date=table_3.date and table_1.date between 20080909 and 20090706;

解决方案 »

  1.   

    我不需要date相同,还有最好能按日期倒序排列.
      

  2.   

    20080909 and 20090706;
    你还可以根据需要改成表单提交过来的时间, 排列顺序也可以在后面加上!呵呵 做数据过滤!
      

  3.   

    单表选取,然后每条SQL间用UNION连接。select * from table1 where $condition
      union
    select * from table2 where $condition
      union
    ...
      

  4.   

    在最后加order by date desc;
      

  5.   

    错了,可以排序,但是怎样用table1.date这样的方法区分结果?除了union有没有别的方法,谢谢.
      

  6.   

    区分不要管他了,除了union有没有别的办法
      

  7.   

    select * from (
    select 'table1' as tablaName, * from table1 where $condition
      union 
    select 'table2' as tablaName, * from table2 where $condition 
      union 
    ...)
    order by date desc;数据量大的话,还是自己专门做个表先将union数据insert by select进去吧。 表里的date应该是索引,然后再从这个表出数据。
      

  8.   

    另外,如果你的数据量不少,操作又比较频繁,那么建议你还是用MERGE表吧