Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Query to find last 10 records

Query to find last 10 records

Scheduled Pinned Locked Moved Database
databasehelp
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sirisha guttikonda
    wrote on last edited by
    #1

    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

    P T S 3 Replies Last reply
    0
    • S sirisha guttikonda

      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

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • P pmarfleet

        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

        S Offline
        S Offline
        sirisha guttikonda
        wrote on last edited by
        #3

        hi, can u plz help me to that... i have very poor knowledge in dat. thank u...

        siri

        P 1 Reply Last reply
        0
        • S sirisha guttikonda

          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

          T Offline
          T Offline
          Thats Aragon
          wrote on last edited by
          #4

          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 replace Date_Created with the autogenerate column. I hope this will help you. Regards.

          "Save water,It's precious" :) "Don't forget to vote" ;) ;P ;)

          1 Reply Last reply
          0
          • S sirisha guttikonda

            hi, can u plz help me to that... i have very poor knowledge in dat. thank u...

            siri

            P Offline
            P Offline
            pmarfleet
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • S sirisha guttikonda

              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

              S Offline
              S Offline
              Sabarinathan T
              wrote on last edited by
              #6

              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...

              S 1 Reply Last reply
              0
              • S Sabarinathan T

                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...

                S Offline
                S Offline
                sirisha guttikonda
                wrote on last edited by
                #7

                Thanks to all

                siri

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups