Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i want to get two tables data in one report 1

Status
Not open for further replies.

ishikha

Programmer
Mar 22, 2002
36
IN
hi friends,

I would like to know how can I use 2 tables data in one Data Report section? They are come with 2 independent SQL statements and I want to show them all in one section. How can I do that?

thank you
ishikha
 
This is a repeated question. But......

Are the tables linked with an Index or Cardinal Key???

If you want the tables linked then, it is only a matter of creating a JOIN.

Select [table1].[ID] as [GloablaID],
[table1].[field1] as [table1_field1],
[table1].[field2] as [table1_field2],
[table2].[field1] as [table2_field1],
[table2].[field2] as [table2_field2]
FROM table1 INNER JOIN on [table1].[ID] = [table2].[ID];

or if you have ID fields in table1 that may not be reproduced in table2 then

FROM table1 LEFT JOIN on [table1].[ID] = [table2].[ID];

or if the IDs may be in Table2 but not table1 then

FROM table1 RIGHT JOIN on [table1].[ID] = [table2].[ID];

or if table1 may has IDs that table2 doesn't and table2 has IDs that table1 doesn't then

FROM table1 OUTER JOIN on [table1].[ID] = [table2].[ID];
Craig, mailto:sander@cogeco.ca
"Procrastination is the art of keeping up with yesterday."
I hope my post was helpful!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top