How to select top 5 after 20 rows

Vítor Norton

I have this query:

select top 5 * from tbl_post ORDER BY Id DESC

I want to select the first 5 rows after the 20th row. How I can do this?

tomsv

Use OFFSET and FETCH MSDN OFFSET FETCH Clause:

SELECT * FROM tbl_post ORDER BY whatever OFFSET 20 ROWS FETCH NEXT 5 ROWS ONLY;

Note that you have to order by something for this to work, and you cannot use top at the same time

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to select top 5 after 20 rows

From Dev

Select next 20 rows after top 10

From Dev

How to select top 20 percent of rows and then find if a row exists there

From Dev

SELECT TOP 20 rows for each group

From Dev

How to select top (5) rows with specified Id and latest date?

From Dev

How do I select 5 random rows from the 20 most recent rows?

From Dev

How to Select Top 100 rows in Oracle?

From Dev

How do I select top rows in SQL

From Dev

Reset counter in select after 5 rows

From Dev

Select TOP row in SQL and get 5 rows of end table

From Dev

MySQL: Select top 5 rows based on ID and find Subtotal

From Dev

SELECT TOP 10 rows

From Dev

how to select top 5 products from table

From Dev

Top 5 rows by month

From Dev

How to select top five or 'N' rows in Oracle 11g

From Dev

In MariaDB how do I select the top 10 rows from a table?

From Dev

How to SELECT top N rows that sum to a certain amount?

From Dev

how to select max top 10 (n) rows with there size?

From Dev

MySQL: select 5 rows before and after specific row

From Dev

how to select characters after first 20 characters from field mysql

From Dev

Select top 2 rows in Hive

From Dev

How come my UITableView is repeating rows after 5 rows?

From Dev

How to improve the performance of my query which uses select top 20 and a bunch of isnull in the where clause?

From Dev

How do we select top 20% and bottom 80% records in sql server

From Dev

How to improve the performance of my query which uses select top 20 and a bunch of isnull in the where clause?

From Dev

Select 20 first rows per each entry

From Dev

Select TOP 5 only returning one row when called through code, where same script returns 5 rows in SQL Server

From Dev

How can I randonly select rows after grouping by a column?

From Dev

Laravel 4 and Eloquent ORM - How to select the last 5 rows of a table

Related Related

  1. 1

    How to select top 5 after 20 rows

  2. 2

    Select next 20 rows after top 10

  3. 3

    How to select top 20 percent of rows and then find if a row exists there

  4. 4

    SELECT TOP 20 rows for each group

  5. 5

    How to select top (5) rows with specified Id and latest date?

  6. 6

    How do I select 5 random rows from the 20 most recent rows?

  7. 7

    How to Select Top 100 rows in Oracle?

  8. 8

    How do I select top rows in SQL

  9. 9

    Reset counter in select after 5 rows

  10. 10

    Select TOP row in SQL and get 5 rows of end table

  11. 11

    MySQL: Select top 5 rows based on ID and find Subtotal

  12. 12

    SELECT TOP 10 rows

  13. 13

    how to select top 5 products from table

  14. 14

    Top 5 rows by month

  15. 15

    How to select top five or 'N' rows in Oracle 11g

  16. 16

    In MariaDB how do I select the top 10 rows from a table?

  17. 17

    How to SELECT top N rows that sum to a certain amount?

  18. 18

    how to select max top 10 (n) rows with there size?

  19. 19

    MySQL: select 5 rows before and after specific row

  20. 20

    how to select characters after first 20 characters from field mysql

  21. 21

    Select top 2 rows in Hive

  22. 22

    How come my UITableView is repeating rows after 5 rows?

  23. 23

    How to improve the performance of my query which uses select top 20 and a bunch of isnull in the where clause?

  24. 24

    How do we select top 20% and bottom 80% records in sql server

  25. 25

    How to improve the performance of my query which uses select top 20 and a bunch of isnull in the where clause?

  26. 26

    Select 20 first rows per each entry

  27. 27

    Select TOP 5 only returning one row when called through code, where same script returns 5 rows in SQL Server

  28. 28

    How can I randonly select rows after grouping by a column?

  29. 29

    Laravel 4 and Eloquent ORM - How to select the last 5 rows of a table

HotTag

Archive