怎样把同一数据库的多个表内的不同字段进行排序并读出.
如比:
[table_1]  字段名:times
[table_2]  字段名:dates
[table_3]  字段名:fdate
只输出这三个表中最近的10条记录.
小弟谢了先

解决方案 »

  1.   

    select 时间
    from
    (
    Select Times as 时间 from table_1
    union all
    Select dates as 时间 from table_2
    union all
    Select fdate as 时间 from table_3
    ) S order by 时间
      

  2.   

    回复人: duper() ( ) 信誉:100  2005-08-09 23:09:00  得分: 0  
     
     
       是多个表.
    不同的字段.  --这个没有干系,反正只要类型一致,个数一致,就 ghostzxp(幽灵)的那样做,加个top 10即可
    select top 10 时间
    from
    (
    Select Times as 时间 from table_1
    union all
    Select dates as 时间 from table_2
    union all
    Select fdate as 时间 from table_3
    ) S order by 时间 desc