>Ok here is the question :
>Lets say that i have a database with client_id,field1,field2, etc..
>and another one related to the previous in a one to many relationship using the client_id field, my question is,
>does anybody suggest a way to retrieve lets say all the client_ids tha satisfy the next condition :
>
>give me all the distinct client_ids whose field1=expresion
>and field1=expresion or field1=expression...etc
>
>note that I need to find a record whose field1 or field2 or
>any other should satisfy multiple conditions.
>
>Thanks in advance for any suggestion.
>
>"Luis Guzman"
Assuming the following:
Table 1 is the Parent (ie 1 Record)
Table 2 is the Child of Table 1 (ie Many Record)
The link between the two tables is Client ID
Select A.* from Table1
From Table1 A, Table2 B ;
Where (a.client_id = b.client_id) And
(Field1=XXX or Field2=YYY)
Group By A.Client_ID
I Prefer to use Group By instead of Distinct.
This will work, but if you have client_id records in Table1 that are not in Table2, they will NOT print. For that U need an outer join to capture all records from Table1 reguarless if they are in Table2 or not. Respond if U need information on the outer join stuff. Fox does not provide a true SQL outer join. U must use Union in your SQL and it can get ugly. HtwH
Steve Medvid
Systems Analyst
Environmental Resource Management