Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    54

    Unanswered: First & last record retrieve

    Is there a simple SQL statement to get the
    last and first record of a table under
    Access and SQL Server ?

    Thanks,
    Pierre.
    Pierre (Pl-Arts)

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: First & last record retrieve

    Tables have no concept of "first" and "last". You need to create a column by which you can order the data. Then you can do something like:

    SELECT * FROM t WHERE col IN (SELECT MIN(col) FROM t
    UNION SELECT MAX(col) FROM t);

Posting Permissions

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