From: rdm32@dana.ucc.nau.edu (Ryan McLean)
Newsgroups: comp.databases.oracle
Subject: Should be a simple query, please help a desperate person at the end of their pitiful rope.
Date: 5 Jun 2003 16:45:35 -0700
Organization: http://groups.google.com/
Lines: 22
Message-ID: <dfec50f9.0306051545.3cfb9bbf@posting.google.com>
NNTP-Posting-Host: 134.114.32.16
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1054856735 16957 127.0.0.1 (5 Jun 2003 23:45:35 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 5 Jun 2003 23:45:35 GMT


I am trying to return one of two records.  The most recend one . . .
why does this not work?

SELECT * 
FROM PARKING_SERVICES_ADM.VEHICLE_INFO 
WHERE RES_PERSON_ID = '8675309' 
AND ROWNUM < 2 
ORDER BY PERMIT_PURCHASE_DATE DESC;

This should be an easy answer . . . thank you in advance for any help.

Thanks, 

Ryan

p.s. the result is the other (wrong) record.  This record has an older
PERMIT_PURCHASE_DATE, I thought the query above would return the
latest record according to the PERMIT_PURCHASE_DATE field.  If I
change the rownum < 2 to rownum < 3, I get the correct order of the
rwo records.

Thanks again!

