> Hi,
>
> I have some trouble with subselects. (Version 6.3).
>
> If I try
>
> Select name, address from costumers where cod_costumer in (
> Select cod_costumer from logins where total_usage > 0);
>
> It take lots of time (really I din't wait till the end).
>
> But if I manualy split in
> Select cod_costumer from logins where total_usage > 0;
> getting
> ( 1, 9, 15, 18 , 40)
> and then use
> Select name, address from costumers where cod_costumer in ( 1, 9,
> 15, 18 , 40);
>
> All is OK.
>
> Is this type of subselect suported ?
>
> Thanks
> Giovanni Floridia
>
Yes it's supported, but the subselect will be executed for each row of
the main select.
This should be a faster select (but not as fast as your second one).
Select name, address from costumers where EXISTS(Select 1 from logins
where total_usage > 0 AND logins.cod_customer = customers.cod_customer);
-DEJ