mvswetha
mvswetha

Reputation: 53

How to get the data through common column in both tables

I am having 2 tables like customer and environment. r_id field is common in both tables but there is no constraints between these 2 table.

With the help customer table r-id I want to retrieve the environment table data.

Can any one help me how to frame the query.

Upvotes: 0

Views: 32

Answers (1)

Alan
Alan

Reputation: 3002

You need to use a JOIN to link the two tables together. For example:

SELECT *
FROM Table1
INNER JOIN Table2 ON Table1.r_id = Table2.r_id

Or alternative (older) syntax:

SELECT * 
FROM Table1, Table2
WHERE Table1.r_id = Table2.r_id

Upvotes: 1

Related Questions