Вопрос

In Netezza, if I do:

SELECT 
   *
FROM Tbl order by col1 
LIMIT 10 OFFSET 20;

First of all, what is OFFSET 20. And also, will this give me the first 10 rows specified in the order by or will the order by apply after random 10 rows are selected? I wish to select the first 10 rows of the table as specified in my order by.

Это было полезно?

Решение

If your table col1 was a list from 1 to 1000

Limit 10 would return 1-10

Limit 10 OFFSET 20 would return 21-31

Remove the Offset to get just the first 10 rows and yes it will process the order by first.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top