Some non-standard dialoects also have a first/last keyword (Transact SQL
does I thing ... It's been a while since I used Sybase).






"Max Renshaw-Fox" <[EMAIL PROTECTED]> on 17/02/99 14:17:30

Please respond to [EMAIL PROTECTED]

To:   Multiple recipients of list delphi <[EMAIL PROTECTED]>
cc:    (bcc: Peter Jones/Logistics&Information
      Technology/Christchurch/Foodstuffs)
Subject:  RE: [DUG]:  SQL - The First Shall Be Last...




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






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

Reply via email to