Friday, March 9, 2012

Join two tables of different database

Hi , let table a belongs to db1 and table b belongs to db2 . how can i join these two tables can any one give me examples... thanx in advance

Quote:

Originally Posted by krishnasarma

Hi , let table a belongs to db1 and table b belongs to db2 . how can i join these two tables can any one give me examples... thanx in advance


try:

select <field list>
from db1.dbo.tableA tbla
left/inner/right/full join db2.dbo.tablB tblb on tbla.linkfiend = tblb.linkfield

dependeing on your requirement, you can choose whether it's a left, inner , full or right outer join. you might also need analyze what field to use to link the two tables

No comments:

Post a Comment