Subject | RE: [firebird-support] Re: derived table within EXISTS (was: Different performance Superserver VS. Embeded ?) |
---|---|
Author | Leyne, Sean |
Post date | 2008-02-25T18:03:30Z |
Dany,
Select
p.PROC, p.EXP1 as EXPE, p.ACTO, p.DEMA, p.OBSE, t.DSCR as D_TPRO
from (
SELECT
distinct PROC
from MOVI
where
TIPO = 'B')
) m
JOIN PROC p on p.PROC = m.PROC
left join TPRO t on p.TPRO=t.TPRO
order by
lower(p.ACTO)
Sean
> Well, I thougth about how selective is MOVI.PROC so I did a few testsresults:
> adding the "distinct" clause, even with your approach, but same
>D_TPRO
> select p.PROC, p.EXP1 as EXPE, p.ACTO, p.DEMA, p.OBSE, t.DSCR as
> from PROC pTry:
> left join TPRO t on p.TPRO=t.TPRO
> where exists(select distinct PROC from MOVI m
> where p.PROC = m.PROC
> and m.TIPO = 'B')
> order by lower(p.ACTO)
Select
p.PROC, p.EXP1 as EXPE, p.ACTO, p.DEMA, p.OBSE, t.DSCR as D_TPRO
from (
SELECT
distinct PROC
from MOVI
where
TIPO = 'B')
) m
JOIN PROC p on p.PROC = m.PROC
left join TPRO t on p.TPRO=t.TPRO
order by
lower(p.ACTO)
Sean