how to select the newest entries ?

hello friend's
Any one have idea how to select last 10 rows from our database without altering any new column in DB.

Replies

  • Morningdot Hablu
    Morningdot Hablu
    No answer !!
  • Prasad Ajinkya
    Prasad Ajinkya
    in mysql, you have the LIMIT keyword, sort by the primary key in desc order and use LIMIT 10. that should do no?
  • Morningdot Hablu
    Morningdot Hablu
    I have tried
    select * from table order by id desc limit 10;
    and
    select * from table order by id limit 10;
    both but it doesn't works !!
  • slashfear
    slashfear
    Hey Mohit,

    Can you specify what database your using because what kidakaka said is right !! in Mysql it will work!! if your using any other database for example in Microsoft SQLserver or SYBASE, LIMIT keyword is not supported so we have to use TOP keyword (mostly in databases it will either support TOP or LIMIT will be available) so this is how you can use your TOP keyword to accomplish the task what you asked for EG: select top 10 * from tablename order by id desc

    -Arvind

You are reading an archived discussion.

Related Posts

Hi friends, I'm sophomore student at DA-IICT. I've good experience with C,C++,Python and Java. I'm interested in Computer Vision,Machine Learning, HCI , AI , interactive media and Collective Intelligence. I'm...
i am investigating the company which provides oem service meaning it has no certain product, but it accepts the orders of both individuals or acts as a supplier. it specifies...
Many Many Happy returns of the day vinod! 🎉
Hey guys... My project is regarding electromagnetic lift... Can you pls send me the links for the complete info regarding Para, Dia, Ferromagnetic properties....
Hello Guys, Have a look at LED SignBoard [youtube]1sgDKDGsGU0[/youtube] ​