db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: maxrows - what does it really mean?
Date Mon, 14 May 2007 21:36:06 GMT
>>>>>>>>>>>> David Van Couvering wrote (2007-05-14 13:11:00):
> Thanks for the tip, Bernt, but I must humbly say "yuck!" to the syntax.
> 
> OK, getting over that, it's pretty worthless to me given that  Derby
> doesn't use it and Derby is the primary DB used by NetBeans.  But
> let's say it was implemented -- would it work with a result set that
> is a join across multiple tables?  I can't tell from the convoluted
> syntax...

I have never used it myself, but assume it would be something like
this:

SELECT * FROM (
  SELECT
    ROW_NUMBER() OVER (ORDER BY key ASC) AS rownumber,
    columns
  FROM (
    SELECT however complex query you want......
  ) AS bar
) AS foo
WHERE rownumber <= n


-- 
Bernt Marius Johnsen, Database Technology Group, 
Staff Engineer, Technical Lead Derby/Java DB
Sun Microsystems, Trondheim, Norway

Mime
View raw message