Solved

New to inner join

Posted on 2008-10-23
4
234 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

816 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

12 Experts available now in Live!

Get 1:1 Help Now