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 |
|
simflex
Constraint Violating Yak Guru
327 Posts |
Posted - 2009-05-13 : 20:24:37
|
| Greetings SQL Gurus,I have 2 tables, tableA and tableBWhen I run a query that says, Select name1, name2, name3 fromfrom tableA where ID = parambId and type IN ('G','M')I get 1 result. This is correct.when I run tableB, select address, city, state from tableB where ID = paramId and otherId = 1It returns 4 records which is correct.The problem is that I want to join the 2 queries using left outer join so I can return everything from tableB and whatever matched from tableA.Any ideas how to get this to work?Thanks in advance. |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-05-13 : 20:48:04
|
| Maybe this?Select A.name1, A.name2, A.name3 ,B.address, B.city, B.state from tableB B left join tableA A on B.ID = A.ID where B.otherId = 1and A.type IN ('G','M') |
 |
|
|
simflex
Constraint Violating Yak Guru
327 Posts |
Posted - 2009-05-13 : 21:24:47
|
| Thank you very much vijayisonly.That worked real good.Thanks a lot |
 |
|
|
|
|
|
|
|