on 08-11-2015 1:30 PM
Hello,
If I want to get the value of let us say the 1st, 1000th, 2000th entry of a particular field, how should I go about. I tried with the below logic. It did not work for me.
select belnr, row_number () over (order by "BELNR") as ROWN from sapshh.bseg where mod( ROWN, 1000 ) = 0
SAP DBTech JDBC: [260] (at 94): invalid column name: ROWN: line 2
col 32 (at pos 94)
I am able to fetch the values of the row_numbers of the rows I select however. The below query returns what I need. But when I use row_number in the where condition, it does not work.
select carrid, row_number () over (order by "CARRID") as ROWN from sapshh.spfli
I also tried with $rowed$ and I get the below error:
select "$rowid$" FROM "SAPSHH"."DD02L" WHERE mod("$rowid$", 10000 ) = 0
Could not execute 'select tabname,
"$rowid$" FROM "SAPSHH"."DD02L" WHERE
mod("$rowid$", 10000 ) = 0' in 369 ms 23 µs .
SAP DBTech JDBC: [2048]: column store error: search table error:
[6901] Attribute engine function not implemented
Don't use $rowid$. Like, ever!
What you want to do is likely this:
select row_num, belnr
from
(select row_number() over (order by belnr asc) row_num, belnr
from bseg)
where mod(row_num, 1000) = 0;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajeev,
Have you tried this.
select * from
(
select belnr, row_number() over(partition by belnr ) as ROWNUM
from sapshh.bseg
)
where = rownum in (1, 1000, 2000);
-Amol S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.