Results 1 to 3 of 3
  1. #1
    Join Date
    May 2010
    Location
    Hyderabad, India
    Posts
    16

    Unanswered: How to fetch the last row from a table

    I need to fetch the last row from a table.

    Is there any inbuilt function to fetch the last row in from a table in sybase??

    any one could you please help me.

    Thanks in advance

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    There is no such thing as first row or last row.
    There is no specific order. If you want data in a specific order you must use an order by clause.
    What do you consider as first or last? Maybe cosider the min() or max() functions.

  3. #3
    Join Date
    Aug 2010
    Posts
    19
    Last row:

    select *
    from mytable
    where id = (select max(id) from mytable)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •