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.
Author |
Topic |
acribb
Starting Member
19 Posts |
Posted - 2006-12-04 : 10:47:33
|
Here is another easy one for you.I have this query which selects 100 loan officers meeting various conditions within the same database.SELECT TOP 100 lu.username, lu.lo_id, lo.lo_name, lo.lo_email FROM lo_users lu INNER JOIN loanofficer lo ON lu.lo_id = lo.id WHERE (lu.company_id = 1) AND (lu.lo_id IS NOT NULL) AND (lu.lo_id <> 0) ORDER BY lu.usernameHowever, I now need to add in the condition that the enrollmentStatus needs to be 'active' on another table called LoanOfficers within another database called STMContinuity. I would like the enrollmentStatus field added to query result.Can you help with this?Thanks again. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-12-04 : 10:49:54
|
INNER JOIN or LEFT JOIN that table too...Peter LarssonHelsingborg, Sweden |
 |
|
acribb
Starting Member
19 Posts |
Posted - 2006-12-04 : 11:01:11
|
How do you do inner joins across 2 different databases? |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-12-04 : 11:04:21
|
Add the other database as a LINKED SERVER.Peter LarssonHelsingborg, Sweden |
 |
|
acribb
Starting Member
19 Posts |
Posted - 2006-12-04 : 12:45:46
|
Ok, got it working. Thanks for the help. |
 |
|
X002548
Not Just a Number
15586 Posts |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-12-04 : 13:36:03
|
Well, I figured out that if he doesn't know about Db.Owner.Table.Column syntax, the "other database" must be on a different server.Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|