Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Subquery to return top row

Re: Subquery to return top row

From: <ahporter_at_montana.edu>
Date: 2000/06/27
Message-ID: <8jb591$vc9$1@nnrp1.deja.com>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US