Click to See Complete Forum and Search --> : Running a query that retrieve data from more than one table


Gustavo Lermen
May 12th, 1999, 06:56 PM
Hi

Is it possible to run a query that retrieve data from more than one table using the CRecordset class?
Ex: "Select Table1.Name from Table1,Table2 where Table1.Number = Table2.Number "


If so, how can I do this?

thanks...

Rajaraman
May 13th, 1999, 04:44 AM
Try this :
select distinctrow Table1.Name <and other fields...>
from Table1 inner join Table1 on Table1.Number = Table2.Number


Rajaraman

Gustavo Lermen
May 13th, 1999, 11:00 AM
Hi....

Can you send me an example code to use this query?

Thanks.....

May 20th, 1999, 12:14 PM
In your GetDefaultSQL function return

"Select Table1.Name from Table1,Table2"

Then when before you Requery, set m_strFilter = "Table1.Number=Table2.Number"
and execute Requery().