Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 join 2 tables

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2005-12-25 : 13:21:16
can someone help me with teh sql to join to tables

both have fields called
firstname
lastname
city
state
country
tel
email

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2005-12-25 : 22:55:10
Are you looking for the cummulative result of both the tables or the matching records from the tables?
Go to Top of Page

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2005-12-26 : 00:52:51
i just want to show all the results joined as one query so I can see all from both tables
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-26 : 00:57:54
Are you looking for something like this?

Select T1.*, T2.* from Table1 T1 inner join Table2 T2 on T1.firstname=T2.firstname

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2005-12-26 : 01:01:51
select firstname,
lastname,
city,
state,
country,
tel,
email
from table1
union
select firstname,
lastname,
city,
state,
country,
tel,
email
from table2

Query will display all the records from both the tables as one table.(but will not show the matching records. use union all to see even the duplicate records)

Go to Top of Page

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2005-12-26 : 01:46:56
thanks - union was what i was looking for -- i just couldn't remember! :)
Go to Top of Page
   

- Advertisement -