Solved

New to inner join

Posted on 2008-10-23
4
237 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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