Subject | Re: [firebird-support] A complicated subquery slows down the main query |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2003-12-10T07:11:17Z |
On 9 Dec 2003 at 19:19, Maciek BOROWKA wrote:
for select aKey from AnotherTable group by aKey having count(*)>1
into :varname do
begin
for select field1, field2, field3 from Atable where AKey=:varname
into :outparam1, :outparam2, :outparam3 do
begin
suspend;
end;
end;
SY, Dimitry Sibiryakov.
>I have a problem with the performance of some of the queries I do.I'd put this into SP. Something like this:
>They are all basically of the same type:
>
>SELECT * from Atable WHERE AKey IN
>(select aKey
>from AnotherTable
>group by aKey
>having count(*) > 1)
for select aKey from AnotherTable group by aKey having count(*)>1
into :varname do
begin
for select field1, field2, field3 from Atable where AKey=:varname
into :outparam1, :outparam2, :outparam3 do
begin
suspend;
end;
end;
SY, Dimitry Sibiryakov.