zoukankan      html  css  js  c++  java
  • 几个关于取从第一行到第几行数据

    select top 5 ID from ActionInfo where ID not in (select top 20 ID from ActionInfo order by ID) order by ID

    select top 5 ID from ActionInfo where not exists (select * from (select top 20 ID from ActionInfo order by ID) a where a.ID=ActionInfo.ID ) order by ID

    select 1 from (select top 20 ID from ActionInfo order by ID) as aa --where aa.ID=[OADB].[dbo].[ActionInfo].ID

    select top 5 ID from ActionInfo where ID > (select max(ID) from (select top 20 ID from ActionInfo order by ID) a ) order by ID

    select top 5 ID from ( select row_number() over (order by ID) as rownumber,* from ActionInfo ) a where rownumber > 20 order by ID

    WITH sss AS(
    SELECT *,ROW_NUMBER() OVER(ORDER BY ID) AS rowNum FROM ActionInfo
    )
    SELECT * FROM sss WHERE rowNum BETWEEN 11 AND 20

  • 相关阅读:
    while练习题
    流程控制之for循环
    流程控制之while循环
    流程控制之if判断
    作业
    基本运算符
    输入输出
    基本数据类型
    变量part2
    JDBC中创建表
  • 原文地址:https://www.cnblogs.com/ZkbFighting/p/8799303.html
Copyright © 2011-2022 走看看