Netezza Limit clause with order by
Asked Answered
S

1

8

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.

Suffolk answered 29/1, 2014 at 15:28 Comment(0)
A
9

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.

Anarthrous answered 29/1, 2014 at 15:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.