Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Subquery to return top row
Thank you, Dmitry.
Unfortunately in this case I do need the ORDER BY to get the correct row to the top. It is dependent first on the PREFERRED_IND and only then on the ACTIVITY_DATE. Just using MAX(ACTIVITY_DATE) will return the newest entry but not necessarily the preferred entry. If there is a preferred entry I need that one; if not, then I need the newest one.
It is a good trick for a PL/SQL function that I can reference from the SQL SELECT, but I cannot store a function in the database.
Thank you for your thoughts. I am no closer to a solution but it has helped clarify my thinking. Looks like ORDER BY is good in Oracle 8. I saw it in some other posts in this newsgroup.
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Jun 27 2000 - 00:00:00 CDT