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 |
|
maevr
Posting Yak Master
169 Posts |
Posted - 2009-11-12 : 02:57:15
|
| I need help creating a join base don the following criteria:Display rows that match eachother in table1 and table2 (inner join) and matches that exists in table3 that resides in table2.If no match between table2 and table3 then do not remove row from result.I have tried the select below but it displays all rows in table2 even those that do not exist in table1.selecta.ida.col1b.idb.col1c.idc.col1FROM table1 b inner join table2 a on a.id = b.id left outer join SS_table3 c on a.id = c.id and b.FormularId = c.FormularIdorder by FormularId |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-11-12 : 03:59:39
|
I think it is because "and b.FormularId = c.FormularId" in ON-clause.Try to do it in WHERE-clause instead of ON-clause. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|