Subject Re: [firebird-support] Efficient subselects
Author Tim Ward
On 18/04/2014 10:29, Josef Kokeš wrote:
> 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.
Yes, I'll note this idea, I've got a similar query I'll probably have to
speed up one day!

--
Tim Ward