Specific output from MYSQL

hi, there are some record stored in a table and i want to retrieve some record , can i add serials numbers in front of every record?
i.e there is a table
index name designation

1 tom clerk
22 jeck clerk
100 Harry clerk
1001 Rohit clerk
a table like this…

i want out put like this

  1. tom clerk
  2. jeck clerk
  3. harry clerk
  4. rohit clerk

means i want a serial no. with every record from database…
as 1,2,3,4 are the serial no. for every record , as its not stored in database… but i want to add it in out put…

and iwant to use this serial no further in my programe…

if you ~have~ a program, i.e. application code written in some language like php, then the best place to append the row numbers is right there in your application language as you loop over the returned rows

doing it with SQL is a ~lot~ more complicated and inefficient

ya its ok…

but major prob is that, i want to show that records on a web pager, the records may exceed more than 1 page…

so its hard to maintian a counter on diff pages…

and i dont want to pas that counter argument in addressbar…


  • on the 1st page, your query would have LIMIT 0,20 for the first 20 rows
  • on the 2nd page, your query would have LIMIT 20,20 for the second 20 rows
  • on the 3rd page, your query would have LIMIT 40,20 for the third 20 rows
  • and so on

no row numbers required