Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2002
    Posts
    1

    Unanswered: determining the last row in a table

    Hellom

    Is there a way to determine the final row in an access database using sql. I would prefer not having to read the entire table and then determine the final table.

    Thanks,

    Ken

  2. #2
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Shello,

    The last row is relative, since SQL can sort it anyway you'd like. Assuming you want the last row entered into the table, and assuming you have an autonumber ID field, then you could make a recordset sorted on the ID field, movelast, and do whatever you need to do with that record.

    enjoy
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  3. #3
    Join Date
    Jul 2002
    Location
    Romania
    Posts
    122
    Last record, first record, who cares? It's just a record. You need what's IN the record, not its position.
    If you REALLY need to have all records sorted by the moment they were entered, you have to add a numeric field and write some code to create a sequence (Autonumber is not good enough for this task), while preventing everybody else from entering data in the table while that code runs...
    But I've never seen anybody to need this kind of information.

    There is no built-in way of doing it.

    Regards,

    Dan

  4. #4
    Join Date
    Jul 2002
    Location
    Australia
    Posts
    147
    SELECT
    TOP 1 [Field1], [Field2]
    FROM
    [TableName]
    ORDER BY
    [Field3]
    DESC

    Cheers,
    Andrew
    There have been many posts made throughout the world.
    This was one of them.

Posting Permissions

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