Solved

New to inner join

Posted on 2008-10-23
4
232 Views
Last Modified: 2010-04-14
What does ".." follow by table name means? mydbname..mytablname1 a
What is the alternative?


select a.test, b.test2
from mydbname..mytablname1 a  
inner join mydbname2..mytable2 b
on a.test = b.test2
where a.test = 'myvalue'
0
Comment
Question by:VBdotnet2005
4 Comments
 
LVL 7

Expert Comment

by:talker2004
ID: 22792825
The only time i have ever seen "..." together like that in sql server is when you are using linked servers.

Normally the ... is not required, but if you are linking an access database to your sql server you will need the ... in order to query the table.

It is also possible to link other databases to your sql server.

http://msdn.microsoft.com/en-us/library/ms188279.aspx


Did you have any other questions or issues with the query?

0
 
LVL 26

Assisted Solution

by:Anurag Thakur
Anurag Thakur earned 25 total points
ID: 22793241
DatabaseName..TableName syntax is normally used when you want to join 2 databases in a query (different kind of joins)
0
 
LVL 20

Accepted Solution

by:
informaniac earned 50 total points
ID: 22793308
.. is used for the username as dbo... if u have a username for the db then u write like this
mydbname.user1.mytablname1
0
 
LVL 10

Assisted Solution

by:jinn_hnnl
jinn_hnnl earned 50 total points
ID: 22794217
addition to those answers:

Normally if you want to join 2 table with foreign key constraints using inner join (which data has to exist in both parent and child table), and these 2 databases are in the same database. You dont have to specify the database name at the beginning. Just go:

(database: Organization)
Select U.*, C.CompanyName
From Companies C
INNER JOIN Users U
ON C.CompanyID = U.CompanyID

if this Users Table is in different database (Branches) then you have to specify:
Select U.*, C.CompanyName
From Companies C
 INNER JOIN Branches.dbo.Users U
 ON C.CompanyID = U.CompanyID
-- or : ON C.CompanyID = Branches.dbo.Users.CompanyID

when you run this query you are connecting to Orgranization database, that's why you only have to mention DB name for Users, but it safe to do both.

Hope this helps

JINN


 
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now