一楼的好像没有排序哦,最终出来的结果是10个空白记录。
微软专家的我觉得要求table1表中的列大于5行才行啊,否则还是不能得到10行记录。比如table1中只有1行记录,那么返回的结果为2行,所以我觉得针对1楼可以改为:select top 10 * from (select * from a union select * from b) aa order by column_name desc 针对微软大师的:
select top 10 column1
from
(
select column1 from table1
union all
select '' from table1
union all
select '' from table1
union all
select '' from table1
union all
select '' from table1
union all
select '' from table1
union all
select '' from table1
union all
select '' from table1
union all
select '' from table1
union all
select '' from table1
union all
select '' from table1
)t
order by Column1 desc
建一个同样结构的数据表,存入10行空数据,比如源表为a,新表为b
则:select top 10 * from (select * from a union select * from b) aa
--这样?以MS SQL为例
select top 10 column1
from
(
select column1 from table1
union all
select '' from table1
)t
order by Column1 desc