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

>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.

In ORACLE you can select ROWNUM for the row ordering.  One issue
in ORACLE at least is that MIN and MAX don't work for dates...

Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax

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

Reply via email to