Question

I want to run a basic query, but return only the first ten rows of the table from Netezza

select a.*
  from some_schema.some_table a
 where rownum < 10

What is the Netezza way of looking at just those few rows?

Was it helpful?

Solution

Ah! Just found it.

For Netezza this query is select a.* from some_schema.some_table a limit 10

-mcpeterson

OTHER TIPS

The below query should work for any random 'N' rows in a netezza table.

SELECT COLNAME1 FROM ( SELECT COLNAME1 FROM SCHEMANAME..TABLENAME ORDER BY COLNAME1 LIMIT n) A
MINUS
SELECT COLNAME1 FROM ( SELECT COLNAME1 FROM SCHEMANAME..TABLENAME ORDER BY COLNAME1 LIMIT m) B

Note : n>m ( m,n are integers )

SELECT * FROM schema_name..table_name LIMIT 100 OFFSET 50

LIMIT is number of records you need, and OFFSET is from where to count!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top