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

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

From Dev

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

From Dev

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

From Dev

How do I select 5 random rows from the 20 most recent 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 to select characters after first 20 characters from field mysql

From Dev

How come my UITableView is repeating rows after 5 rows?

From Dev

How to Select Top 100 rows in Oracle?

From Dev

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

From Dev

Select 20 first rows per each entry

From Dev

Reset counter in select after 5 rows

From Dev

MySQL: select 5 rows before and after specific row

From Dev

Select top 2 rows in Hive

From Dev

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

From Dev

SELECT TOP 20 rows for each group

From Dev

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

From Dev

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

From Dev

Select next 20 rows after top 10

From Dev

How do I select top rows in SQL

From Dev

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

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

how to select top 5 products from table

From Dev

How to select top 5 after 20 rows

From Dev

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

From Dev

Top 5 rows by month

From Dev

SELECT TOP 10 rows

From Dev

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

From Dev

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

Related Related

  1. 1

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

  2. 2

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

  3. 3

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

  4. 4

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

  5. 5

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

  6. 6

    how to select characters after first 20 characters from field mysql

  7. 7

    How come my UITableView is repeating rows after 5 rows?

  8. 8

    How to Select Top 100 rows in Oracle?

  9. 9

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

  10. 10

    Select 20 first rows per each entry

  11. 11

    Reset counter in select after 5 rows

  12. 12

    MySQL: select 5 rows before and after specific row

  13. 13

    Select top 2 rows in Hive

  14. 14

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

  15. 15

    SELECT TOP 20 rows for each group

  16. 16

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

  17. 17

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

  18. 18

    Select next 20 rows after top 10

  19. 19

    How do I select top rows in SQL

  20. 20

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

  21. 21

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

  22. 22

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

  23. 23

    how to select top 5 products from table

  24. 24

    How to select top 5 after 20 rows

  25. 25

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

  26. 26

    Top 5 rows by month

  27. 27

    SELECT TOP 10 rows

  28. 28

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

  29. 29

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

HotTag

Archive