Try

SELECT * FROM Custoly
WHERE CustNo = (SELECT MIN(CustNo) FROM Custoly)
 OR CustNo = (SELECT MAX(CustNo) FROM Custoly)

(Where did I get the names from - ...\Demos\Data)

if you want first and last by Primary Key rather than natural order.

Max

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Mark Derricutt
Sent: Wednesday, 17 February 1999 13:59
To: Multiple recipients of list delphi
Subject: [DUG]: SQL - The First Shall Be Last...


Does anyone know if its possible to write an SQL query that returns the
first and last record in a table???


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to