A Table has 10,000 records,How can i get latest 10 dates
from the table.so that i can only store those 10 records
in to my Resultset Object,to reduce load on my app?
Answers were Sorted based on User's Feedback
Answer / ravikumar.s
select * from (select * from tblname order by datecolumn
asc) where rownum<=10;
There is no keyword in oracle like limit, only we can fetch
through rownum
in mysql only this limit is available
ex: select col from tbl limit 20;
in sql server we use Top keyword instead of limit;
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / sonu
Answer of Ravikumar.s is almost write but there is slightly
mistake, he should write 'desc' keyword instead of 'asc'
because question for latest records not for the oldest
records. So, the correct answer is
select * from (select * from tablename order by datecolumn
desc) where rownum<=10;
One keyword makes the statement and result write or wrong
so, use these carefully.
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / syam kumar
SELECT * FROM emp order by emp_date asc limit 10;
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / laxman
select payment_id,payment_date from care_billing_payment
order by payment_id desc limit 10;
this query give latest 10 rows;
| Is This Answer Correct ? | 6 Yes | 7 No |
Answer / rajesh
select * from(select * from table_name order by date_column
desc) where rowid<=10
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / laxman
SELECT * FROM emp group by emp_date asc limit 10;
| Is This Answer Correct ? | 2 Yes | 6 No |
Answer / ranjan satapathy
Your query: to get latest 10 dates from the table
select date_column , *
from table
where date_column between sysdate and (sysdate-10)
will show the latest date upto 10 last day
| Is This Answer Correct ? | 2 Yes | 8 No |
How do you use trigger to create mutating state of table
what are all the conversion and interfaces in GL,AP,AR,HRMS with example? otherwise send send link for these
0 Answers Pathway Technologies,
what is the difference b/w oracle8i and oracle9i
Give two methods you could use to determine what DDL changes have been made.
I am working in Oracle Clinical 4.5.1 Please explain a bit.How to create Views in OC
What view would you use to look at the size of a data file?
How do you create a credit note against an invoice? : oracle accounts receivable
What is the architectural difference between Oracle and SQL Server 2000? If I have 100 databases, how many instances get created when you use Oracle and how many get created when you use SQL Server?
A table is classified as a parent table and you want to drop and re-create it. How would you do this without affecting the children tables?
What is auto invoicing? : oracle accounts receivable
How do you resize a data file?
how to replace not in with not exist?