Group by's usually have to do a fair amount of work to determine the dupes.
I assume you have proper indexes on both those columns? Is this any
from account_info_ai ai
WHERE EXISTS (SELECT * FROM join stock_position_current_spc spc WHERE
spc.spc_ai_acct_key = ai.ai_acct_key)
Andrew J. Kelly
SQL Server MVP
"chris" <com> wrote in message
> >You shouldn't need distinct and group by in this query.[/ref]
> Just use the group [/ref]...