I presume you mean without using the queryForList(id, parms, skip, max) call in iBATIS. ;-)

Using that it is a snap:

List topNList = queryForList("Customer.getTransactions", parms, 0, n);

Without that, depending on the database, it can be done.

SQL server has a "top (n)" syntax that you can use, and i think Oracle has a rowid that you can use in a nested select (i.e., select blah from (select ... ) where rowid <= 100 to get the top 100).

In a db with stored procedures it would be fairly straightforward to do, too.

Larry


On 4/29/05, Nathan Maves <[EMAIL PROTECTED]> wrote:
Say you had a customer transaction table that held all of the
transactions for your customers.

Is there any way in one query to pull back the last n number of
transactions for all customers?

This is only a hypothetical instance.... Mine is much more difficult :)

Nathan


Reply via email to