Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Subquery to return top row
Hello, again
May be I was not clear enough, I had mentioned about SECOND subquery like this one:
SELECT
SUBSTR(spriden_first_name,1,12) "FIRST"
,SUBSTR(spriden_last_name,1,12) "LAST"
,goremal_email_address "E-MAIL" <-- need one of these
FROM
spriden, goremal goremalOUT
WHERE
goremal_pidm = spriden_pidm AND goremal_preferred_ind =
Hth,
Dmitry Pugachev, Oracle DBA
> 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 Wed Jun 28 2000 - 00:00:00 CDT