Fordraiders
asked on
Inner Joining 3 tables from 3 different databases
Does anyone have sample sql statement, using -- Inner Joining 3 tables from 3 different databases ?
Please
Very hard to find these types of examples...
Thanks
fordraiders
Please
Very hard to find these types of examples...
Thanks
fordraiders
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, They are in the same "instance".
Here is what works for 2 tables from 2 different databases..
select SKU_VIEW.ITEM,
SKU_VIEW.WWGMFRNAME,
SKU_VIEW.WWGMFRNUM,
WWGDESC_ALL.dbo.WwgDescRic h.RICHTEXT
from ITEM_DISPLAY.dbo.SKU_VIEW INNER JOIN WWGDESC_ALL.dbo.WwgDescRic h ON
ITEM_DISPLAY.dbo.SKU_VIEW. ITEM = WWGDESC_ALL.dbo.WwgDescRic h.ITEM
I would like to do the same with another table from another databases.
Database = XrefInfo
Table name = dbo.XrefDetail
pk column = ITEM
Field I need in the query = REDBOOKNUM
Sorry , Guess I should have added this to the question..
Thanks
fordraiders
Here is what works for 2 tables from 2 different databases..
select SKU_VIEW.ITEM,
SKU_VIEW.WWGMFRNAME,
SKU_VIEW.WWGMFRNUM,
WWGDESC_ALL.dbo.WwgDescRic
from ITEM_DISPLAY.dbo.SKU_VIEW INNER JOIN WWGDESC_ALL.dbo.WwgDescRic
ITEM_DISPLAY.dbo.SKU_VIEW.
I would like to do the same with another table from another databases.
Database = XrefInfo
Table name = dbo.XrefDetail
pk column = ITEM
Field I need in the query = REDBOOKNUM
Sorry , Guess I should have added this to the question..
Thanks
fordraiders
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks to all !
from
database1.dbo.tablename d1
join database2.dbo.tablename d2 on d1.field2 = d2.field2
join database3.dbo.tablename d3 on d2.field3 = d3.field3
make sense?