suppose i have more than 2 table and i want to join the specific column to be join .for this what is query?
Asked
Active
Viewed 2.3k times
7
-
What DBMS are you using? – Abe Miessler Sep 07 '10 at 14:30
-
@Abe, in this question http://stackoverflow.com/questions/3656099/how-to-delete-rows-in-tables-that-contain-foreign-keys-to-other-tables pradeep confirms that he is using SQLServer 2008. – Sep 07 '10 at 15:38
-
1I hereby award you the elusive "Detective" badge. – Abe Miessler Sep 07 '10 at 15:59
1 Answers
11
example:
select a.column1, a.column2, b.whatever, c.hello
from table1 a
join table2 b on a.keyfield = b.keyfield
join table3 c on a.keyfield = c.keyfield
If you wanted all records from table1 even without a matching record in another table, then the join should be "left join" instead.

Fosco
- 38,138
- 7
- 87
- 101