Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Grifter
Constraint Violating Yak Guru
274 Posts |
Posted - 2011-11-02 : 07:21:53
|
| HiWhen joining two tables and you want to see all data from say tableA that matches data in TableB but also want to see data that does not match from Table A; is the join then:select *from table A left outer join Table B on A.ID = B.IDWhen you say 'LEFT OUTER JOIN' are you referring to the table in the left of the join statement (table A left outer join Table B) or the join condition (A.ID = B.ID) because you could easily say (B.ID = A.ID) then the left outer join would be on the other table.Thanks for clarifying thisG |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-02 : 07:24:38
|
| nope. its table that we're refering toA LEFT JOIN B means A is base table (whose all rows are returned)B LEFT JOIN A means other way roundsimilarlyA RIGHT JOIN B means B is base table (table on right side wose all rows are retrieved)the condition specified would be same whether you specify it as A.ID = B.ID or B.ID = A.ID------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Grifter
Constraint Violating Yak Guru
274 Posts |
Posted - 2011-11-02 : 07:46:35
|
| HiOk so where the reference to the table in the actual join condition does not matter....A.ID = B.IDG |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-02 : 07:50:19
|
quote: Originally posted by Grifter HiOk so where the reference to the table in the actual join condition does not matter....A.ID = B.IDG
yes...thats rightyou can check it yourself by creating two sample tables and doing left join between them------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
jassi.singh
Posting Yak Master
122 Posts |
|
|
|
|
|