|
-
Feb 11th, 2005, 01:15 PM
#1
Re: Multiple Join To Different DB
Whenever I am going to do cross database joins, I use the little trick in QUERY ANALYZER where you RIGHT CLICK on the TABLE, drag it into the QUERY pane and let go of the mouse. Choose SELECT from the drop-down menu.
Doing that gets you the fully qualified name of the database - one that is guaranteed to work.
-
Feb 12th, 2005, 06:52 AM
#2
Thread Starter
Evil Genius
Re: Multiple Join To Different DB
Hi Guys! Thanks for the help so far! Ok to take your sample bruce with the pubs/northwind databases, here's what i'm trying to do:
Select employee.fname, employee.lname,
jobs.job_id,
db2.lastname
From Employee
Inner Join Northwind..Employees DB2 On db2.employeeid = Employee.job_id
RIGHT OUTER JOIN Northwind..Employees DB3 on db2.employeeid = jobs.job_id
-
Feb 12th, 2005, 07:06 AM
#3
Thread Starter
Evil Genius
Re: Multiple Join To Different DB
Ok got it thanks! Here's the sort of thing i was trying to get. Many thanks again for those suggestions to help me find this! Much appreciated!
SELECT DB1_tbl1.[job_id], DB1_tbl2.[lorange]
FROM [pubs]..[jobs] AS DB1_tbl1
INNER JOIN [Northwind]..[Employees] AS DB2_tbl1 ON DB1_tbl1.[job_id] = DB2_tbl1.[employeeid]
LEFT OUTER JOIN [pubs]..[roysched] AS DB1_tbl2 ON DB2_tbl1.[employeeid] = DB1_tbl2.[lorange]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|