Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Joining two tables using only foreign keys

$
0
0

Hi All,

I have come accros this for the first time regarding joing the tables using only foriegn keys.

I have 3 tables Table1, Table2, Table3

Table1:

Coulmns :

ID_PK

Name

Table2

Columns:

ID_FK

Email

Table3

ID_FK

Address

I have written my query like below:

Select Table2.Email, Table3.Address from Table2 join Table3 on Table2.ID_FK = Table3.ID_FK

Where Table2.ID_FK = '3'

I am getting the reult as expected.

Can anyone tell me, if this is the correct way of writing the sql query?

Appreciate your help.

Thanks,

mds


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>