Query to find last 10 records
-
hi all can u plz help me... here iam writing the query to get top 10 records from tbl_person table. i.e select Top 10 * from tbl_person here it is diplaying top 10 ..that is ok but i want to display the last 10 records(last entered)... is there any possibilities.... thankyou.
siri
-
hi all can u plz help me... here iam writing the query to get top 10 records from tbl_person table. i.e select Top 10 * from tbl_person here it is diplaying top 10 ..that is ok but i want to display the last 10 records(last entered)... is there any possibilities.... thankyou.
siri
-
Apply a sort so that the last entered records are output first.
Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush
hi, can u plz help me to that... i have very poor knowledge in dat. thank u...
siri
-
hi all can u plz help me... here iam writing the query to get top 10 records from tbl_person table. i.e select Top 10 * from tbl_person here it is diplaying top 10 ..that is ok but i want to display the last 10 records(last entered)... is there any possibilities.... thankyou.
siri
Hi Sirisha!
sirisha guttikonda wrote:
but i want to display the last 10 records(last entered)...
Is there any Datetime column in Table,which store the record with it's created time? If yes then you can easily retrieve the desired output.
select top(10) * from tbl_person order by Date_Created desc
Even If you have autogenerate column in table then also you can find record from above query,just replaceDate_Created
with the autogenerate column. I hope this will help you. Regards."Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)
-
hi, can u plz help me to that... i have very poor knowledge in dat. thank u...
siri
sirisha guttikonda wrote:
can u plz help me to that... i have very poor knowledge in dat.
I'm not going to write your code for you. However I suggest you add an
ORDER BY
clause to your query to sort the records in the right order. Then select the records you want. If you have poor knowledge of SQL, I suggest you purchase a SQL book.Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush
-
hi all can u plz help me... here iam writing the query to get top 10 records from tbl_person table. i.e select Top 10 * from tbl_person here it is diplaying top 10 ..that is ok but i want to display the last 10 records(last entered)... is there any possibilities.... thankyou.
siri
Hi siri, U can write the query like Select top 10 * from tbl_person order by (Keycolumn) desc. Does this help?
Sabarinathan T, Chennai, India. The interests are to know something about everything and everything about something...
-
Hi siri, U can write the query like Select top 10 * from tbl_person order by (Keycolumn) desc. Does this help?
Sabarinathan T, Chennai, India. The interests are to know something about everything and everything about something...
Thanks to all
siri