Subject RE: [firebird-support] First 1 and order by in subselect
Author agung wibowo
select
CAMPAIGN_NAME,
(
> SELECT
> first 1 EE_SP_APPROVAL.APPROVAL_TYPE
> FROM
> EE_LNK_SHEDULE_APPROVAL
> LEFT OUTER JOIN EE_SP_APPROVAL ON
>(EE_LNK_SHEDULE_APPROVAL.EE_SP_APPROVAL_ID = EE_SP_APPROVAL.ID)
> WHERE
> (
> (EE_LNK_SHEDULE_APPROVAL.EE_SP_SCHEDULE_ID =
>EE_SP_SCHEDULE1.ID)
> )
> ORDER BY EE_LNK_SHEDULE_APPROVAL.created desc /*WORKS IF
>TAKEN OUT*/
> ) APPROVAL_TYPE
>from
> EE_SP_SCHEDULE EE_SP_SCHEDULE1



hi,..

if I'm not wrong..

try this :

SELECT

CAMPAIGN_NAME,

(

SELECT first 1 EE_SP_APPROVAL.APPROVAL_TYPE

FROM EE_LNK_SHEDULE_APPROVAL

LEFT OUTER JOIN EE_SP_APPROVAL ON
(EE_LNK_SHEDULE_APPROVAL.EE_SP_APPROVAL_ID = EE_SP_APPROVAL.ID)

WHERE ((EE_LNK_SHEDULE_APPROVAL.EE_SP_SCHEDULE_ID
=EE_SP_SCHEDULE1.ID) AND

(EE_LNK_SHEDULE_APPROVAL.created=(select max(created) from
EE_LNK_SHEDULE_APPROVAL))

)



) APPROVAL_TYPE

from

EE_SP_SCHEDULE EE_SP_SCHEDULE1


it's may be work



cheers

agung w www.firebird-indonesia.com <http://www.firebird-indonesia.com/> /
www.friebird-indonesia.net <http://www.friebird-indonesia.net/>



[Non-text portions of this message have been removed]