‎2008 Nov 25 10:38 AM
Hi,
Suppose I have a table with columns Id and Name, and I want to get
rows 6 to 10 (both inclusive) of that table, in sql I would write query
like
select top 5 Name, Id from (
select top 10 Name, Id from MyTable order by Id
) as student order by Id desc
Can anyone tell me how to write this nested query in ABAP ?
Thanks,
Srini.
‎2008 Nov 25 10:48 AM
Hi,
Try this,
var1 = 6
var2 = 10
select * from table to itab.
delete itab where sy-tabix >var2 and sy-tabix < var1.
required data is in itab
‎2008 Nov 25 10:42 AM
hi
I think u shd select all the data.
and moidfy ur internal table with sy-tabix.
Regards
Rasheed
‎2008 Nov 25 10:46 AM
‎2008 Nov 25 10:54 AM
hi
I think in the query level u cant do u can select upto n rows. but u can take ranges for rows.
after selecting the data . loop to tht internal table and delete the records and modify tht internal table.
if u find the solution in query level u can post in SDn
Regards
rasheed
‎2008 Nov 25 11:04 AM
Hi,
I couldn't get the desired result in the form of nested queries.
But by reading n rows and deleting it using sy-tabix i got the solution. (Solution by Shwethali)
Thanks,
Srini.
‎2008 Nov 25 10:47 AM
Hi
Please tell your requirement clearly,
if you are selecting the values from same table you dont need to write nested select queries.
if you are using more than one table better you go for FOR ALL ENTRIES or INNER JOINS
still if you want use aggregate functions like MAX COUNT etc
regards
Ramchander Rao.K
‎2008 Nov 25 10:48 AM
Hi,
Try this,
var1 = 6
var2 = 10
select * from table to itab.
delete itab where sy-tabix >var2 and sy-tabix < var1.
required data is in itab