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 |
|
RoLYroLLs
Constraint Violating Yak Guru
255 Posts |
Posted - 2004-07-29 : 19:13:50
|
| Hey all. I just tried running a query with inner join on two tables. TableA has some rows and TableB has rows as well. Each row in TableA may or may not have a row in TableB associated with it. When I run a query to return a particuluar record based on the column i choose in TableA, it should show me the data in TableA and any data in TableB if it has any. I'm only familiar with inner joins, and i think this may be something of outer join, left outer or right or whatever kinda joins. I keep reading on those, but I never quite truely grasp the idea/uses behind those without true examples, since I have never ran into a situation needing them.- RoLY roLLs |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-07-29 : 19:20:48
|
| This would be a left outer join.SELECT column_listFROM TableA aLEFT OUTER JOIN TableB b ON a.id = b.idINNER JOIN - returns where you have matches in both columnsLEFT JOIN (left outer join) - returns all of left (TableA) and right (TableB) where it matchesRIGHT JOIN (right outer join) - returns all of right (TableB) and left (TableA) where it matchesMeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
RoLYroLLs
Constraint Violating Yak Guru
255 Posts |
Posted - 2004-07-29 : 19:43:17
|
wow couldn't get simpler than that. Gosh darn technical terms never said it that way! I like that explination very much. thanks MODBA, although i think the last one u meant RIGHT JOIN...thanks again, works great!- RoLY roLLs |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-07-29 : 20:28:44
|
| I did. Sorry.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
|
|
|