表user
id name age point
1  jack 18   65
2  mary 17   75
3  tom  20   56
4  ken  15   87
5  lee  18   56select top 3 * from useru where num>17 order by point desc
查询出来了是这样的
id      name    age     point
1 jack 18 65
5 lee 18 56
3 tom 20 56
现在我要把 2  mary 17   75 放上去,结果
id      name    age     point
2 mary 17 75
1 jack 18 65
5 lee 18 56
条件固定,怎么做

解决方案 »

  1.   

    select  * from useru where id=2
    union all
    select * from (select top 2 * from useru where num>17 order by point desc) t楼主需要说明一下结果是怎么来的
      

  2.   

    select top 3 * 
    from (select *,case id when 2 then 0 else 1 end as orderid from useru) a 
    where num>17 
    order by orderid,point desc
      

  3.   

    select top 3 * from  
    (
    select  * ,0 as px from useru  where name ='mary' 
    union all
    select top 3 *,1   from useru where age>17 order by point desc
    )useru order by [point] desc,px
      

  4.   


    ;with tb_new as (
      select top 2 * from useru where num>17 order by point desc
    )
    select select  * from useru where id=2
    union all select * From tb_new