Subject Re: [firebird-support] Efficient subselects
Author Josef KokeŇ°
On 18.4.2014 11:10, Thomas Beckmann wrote:
> Hi Josef,
>
> what I figured out to be quite handy, is to write something like:
>
> select
> MASTER.*,
> cast(left(S, 10) as bigint),
> cast(substring(S from 10 for 10) as bigint),
> cast(right(S, 10) as bigint),
> from (SELECT MASTER.ID,
> (SELECT
> lpad(SUM(VALUE1), 10) ||
> lpad(MAX(VALUE2), 10) ||
> lpad(MIN(VALUE1), 10)
> FROM DETAIL
> WHERE DETAIL_ID=MASTER.ID) as S
> FROM MASTER
> WHERE NAME STARTING WITH 'A') s
> join MASTER m on m.ID = s.ID
>
> Thomas

Interesting approach. I will consider it, maybe it would be sufficient
for my needs.

Thanks!

Josef