jcrshankar
jcrshankar

Reputation: 75

how to use page break in sql?

is there is any way to use page break in sql.actually am generating report with the help of shell script spool command.i need to break the report to next page once it got reach at line number 35. how to write sql statement for this?

Upvotes: 0

Views: 4767

Answers (2)

Henrique Gonçalves
Henrique Gonçalves

Reputation: 1582

Well, I think that LIMIT is what you need. like this:

SELECT * FROM `your_table` LIMIT 0, 10
(This will display the first 10 results from the database)

SELECT * FROM `your_table` LIMIT 5, 5
(This will show records 6, 7, 8, 9, and 10)

SELECT * FROM `your_table` LIMIT 20, 10
(This will return 10 records from 21st record. That is from 21st record to 30th  record)

Hope this helps

Upvotes: 1

JNK
JNK

Reputation: 65187

You should do this in your calling application, pagination of output is not something SQL is suited for.

Upvotes: 2

Related Questions