need to write sql select last row of table
need to write sql select last row of table
(OP)
i have a table contain 1000 of records. I need to display last row of the table.
please let me know how to do it in SQL. I tried all Select statement but could not get it. I can count total rows with Select Count(*) from Table; but how to get the last row.
please let me know how to do it in SQL. I tried all Select statement but could not get it. I can count total rows with Select Count(*) from Table; but how to get the last row.





RE: need to write sql select last row of table
Select Top 1 myName, myID from myTable Order by myID DESC
See the TOP predicate in SQL books on line, downloaded from:
http
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting
Steam Engine enthusiasts: www.essexsteam.co.uk
RE: need to write sql select last row of table
RE: need to write sql select last row of table
Firebird
select FIRST 1 from <your table> order by <field> DESC
Access
select TOP 1 from <your table> order by <field> DESC
If you are using else, search for something equivalent in it's sql language reference (for example Interbase has ROWS clause)
RE: need to write sql select last row of table
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting
Steam Engine enthusiasts: www.essexsteam.co.uk
RE: need to write sql select last row of table