View Single Post

   
  #3 (permalink)  
Old 02-26-2008, 06:05 PM
Alex Kizub
 
Posts: n/a
Default Re: Row Number or subset of select.



Mark A wrote:

> "Alex Kizub" <akizub@yahoo.com> wrote in message
> news:402AAF8B.34DCD873@yahoo.com...


> If you just need the first 10 rows, you can use the following on the end of
> your select
> FETCH FIRST 10 ROWS ONLY
> See the SQL reference.
>
> If you want some other range of rows (in the middle of the answer set), then
> look at the OLAP functions with row_number () over


Mark: Thanks a lot. I'm really happy! Before our DBAs told me that this
impossible
But I still have a little problem. It doesn't work:
For SQL
select a,b,c from t order by a
I have the result.
A little modification to
select row_number() over (order by a), a,b,c from t order by a
returns me this:
SQL0104N An unexpected token "(" was found following "". Expected tokens may
include: ", FROM INTO ". SQLSTATE=42601

and this
select a,b,c from t where row_number() over (order by a) < 10 order by a
returns this:

SQL0104N An unexpected token "OVER" was found following "". Expected tokens may
include: "< > = <> <= !< !> != >= ¬< ¬> ¬= IN NOT ". SQLSTATE=42601

I played a bit during all these hours. Have no clue.
Can you help me again, please?

Alex.

Reply With Quote