Subject | Re: [firebird-support] select in (subquery) |
---|---|
Author | Lester Caine |
Post date | 2004-12-01T08:23:36Z |
Mauricio I Magni wrote:
main query - to give you a list of Persona_id records you are interested
in, and then JOIN to Personas to provide the additional fields?
I use this all the time to provide caller details from a large table
into a short sub list of interesting records.
SELECT b.Persona_id
, p.Apellido
, p.Nombre
from Beneficiarios b
JOIN Personas p ON p.Persona_id = b.Persona_id
WHERE b.Beneficiario_Titular_Id = :Titular_ID
I'm returning several records from 500,000 in no time at all.
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
>>select , p.NombreAm I missing something when I ask - Why not use the sub-select as the
>> from Personas p
>> where EXISTS(
>> SELECT select 1 from Beneficiarios b
>> WHERE p.Persona_id = b.Persona_id
>> and b.Beneficiario_Titular_Id = :Titular_ID
>> )
main query - to give you a list of Persona_id records you are interested
in, and then JOIN to Personas to provide the additional fields?
I use this all the time to provide caller details from a large table
into a short sub list of interesting records.
SELECT b.Persona_id
, p.Apellido
, p.Nombre
from Beneficiarios b
JOIN Personas p ON p.Persona_id = b.Persona_id
WHERE b.Beneficiario_Titular_Id = :Titular_ID
I'm returning several records from 500,000 in no time at all.
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services