WEll Order by is not hte solution because you donot want the top 10 values of colums..like top 10 rankers in a class. I want the records to be in place as it is and not sorted...now the last 10 records/rows and first ten rows(this can be acheived throuw row num). please give answer for last ten rows...
As per my understanding oracle first fetch result set and then it will number records by rownum. So rownum can not be used to get first/last n rows
select *
from tab (select count(*) row_seq_no <select all columns and alias them to column name_1 > from tab group by <all columns>) tab1 (select count(*) total_rows from tab) tab2
where tab.<column_name tab1.<column_name_1> (for all columns) and row_seq_no < 10
(for last 10 rows (tab2. total_rows - row_seq_no <10)
select empno from (select empno rownum l from emp) where l > (select max(rownum) - 10 from emp);
this will give you the last ten rows...but there is a problem
we have to specify individual column name or field name we want to extract...like empno empid..But I donot know how to extract all of them at once like we do with
select * from emp; unfortunately select * rownum from emp doesn't work...Hope to find a soultion for this...
Yes It would But what my table is big and has say about 50 columns...It would waste your time typing them all...there must have been a solution...by the way did u test the query