On May 13, 2008, at 6:11 PM, Matt Chambers wrote:

Normally, I would do a SELECT * FROM spool_table ORDER BY date_inserted ASC LIMIT 100 to grab the oldest entries but Derby can't do limit and you can't user ORDER BY in sub selects. So how do I get my data out of the table in small chunks in the same order it went in?

Matt:

You can write your query like this:

SELECT ROW_NUMBER() OVER() as rownum, spool_table.* FROM spool_table ORDER BY date_inserted WHERE rownum <= 100

And it should do the trick. This requires Derby 10.4.

Hope it helps :)

Geoff

Reply via email to