你这样试试。
select * from (select top 3 * from chk1
order by cnt desc)a
union
select * from (
select top 3 * from chk2
order by cnt desc)b

解决方案 »

  1.   

    union的記錄集不能用order by 
    你借助臨時表吧:create table #a(...)
    insert into #a...
    select top 3 * from chk1
    order by cnt descinsert into #a...
    select top 3 * from chk2
    order by cnt descselect * from #adrop table #a
      

  2.   

    select c.* from(select top 3 * from chk1
    order by cnt desc)
    union all
    select top 3 * from chk2
    order by cnt desc
      

  3.   

    select c.* from (select top 3 * from chk1
    order by cnt desc) c
    union all
    select top 3 * from chk2
    order by cnt desc这个是可以的
      

  4.   

    没看懂,不过你的意思好像是将两个表里面的数据全都读到一个临时表里,再排序,这样数据量太大了,就像下面这样的:
    select top 3 * from (
    select * from chk1
    union
    select * from chk2) t
    order by t.cnt desc
      

  5.   

    to shuichangliu:
      你的办法不对,结果是:
    4 1 5
    1 1 4
    2 2 4
      

  6.   

    to progress99:
      你的办法我试过,好用是好用,不过在记录集里取不到结果