就是选出表中按时间排列的前50行,不准用select top 50 * from tb order by ..
不准用set rowcount 50  select * from tb order by .. set rowcount 0用一条sql完成。

解决方案 »

  1.   

    select *
    from t a
    where (select count(*) from t where 主键<=a.主键)<=50
      

  2.   

    select identity(int,1,1) as PID,a.* into #t from tb a order by ..select * from #t where PID <=50
      

  3.   

    如果都不用,神??那只能是用你的where條件了
      

  4.   

    支持 lsxaa(小李铅笔刀) 的:
    select *
    from t a
    where (select count(*) from t where 主键<=a.主键)<=50
      

  5.   

    其实是我用的sybase的数据库,没有top关键字。程序中执行三条语句麻烦。所以出此下策
      

  6.   

    select *
    from aa a
    where (select count(*) from aa  where 日期e<=a.日期)<=50 order by 日期
      

  7.   

    select *
    from aa a
    where (select count(*) from aa  where 日期<=a.日期)<=50 order by 日期