怎样把同一数据库的多个表内的不同字段进行排序并读出.
如比:
[table_1] 字段名:times
[table_2] 字段名:dates
[table_3] 字段名:fdate
只输出这三个表中最近的10条记录.
小弟谢了先
如比:
[table_1] 字段名:times
[table_2] 字段名:dates
[table_3] 字段名:fdate
只输出这三个表中最近的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 时间
是多个表.
不同的字段. --这个没有干系,反正只要类型一致,个数一致,就 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