[EMAIL PROTECTED] wrote:
    Thanks for the reply. The main aim is to select the first record or
the last record. Is there any direct command for these. Please help me
in this.

There is no first or last unless there is a sort order.

To get the first row:

select * from table
  order by col1
  limit 1

...and to get the last row:

select * from table
  order by col1 DESC
  limit 1

DESC in this case means descending, the default for ORDER BY is ASC, wich is short for ascending.

LIMIT 1 is used to limit the result to only one row.

--
Roger


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to